Results 1 to 2 of 2

Thread: Using storeId on a Ext.data.Store isn't making unique instances

  1. #1
    Sencha User
    Join Date
    Jun 2007
    Posts
    266
    Answers
    7

    Default Answered: Using storeId on a Ext.data.Store isn't making unique instances

    I have a store `APP.store.Posts` that I want to instantiate 3 different times. They will all hold the same type of data, but will be using different parameters when reloading, paging, etc. In a controller, I do this in the `onLaunch` function.

    Code:
        onLaunch: function() {
    
            Ext.create('APP.store.Posts',{
                storeId: 'unclassifiedPosts'
            });
            Ext.create('APP.store.Posts',{
                storeId: 'positivePosts'
            });
            Ext.create('APP.store.Posts',{
                storeId: 'negativePosts'
            });
        },
    Then later, in the `beforerender` listener methods I created on the controller, I do this:

    Code:
        beforeRenderPostsGrid: function(grid) {
            var store = Ext.getStore('unclassifiedPosts');
            store.load();
        },
        beforeRenderPositivePostsGrid: function(grid) {        
            var store = Ext.getStore('positivePosts');
            store.getProxy().extraParams = {'some_param' : 'some_value'};
            store.load();
            var checkOtherStore = Ext.getStore('unclassifiedPosts'); //THIS STORE NOW HAS SAME PARAMS AS positivePosts STORE
        },
    The problem is, whichever `beforerrender` grid is called last, all 3 stores have those parameters. So the initial load is fine, but if I do any refresh, paging, etc. They all show the same data b/c the proxies for each store have identical extraParams somehow.

    From what I understood, the `storeId` parameter was supposed to make my store unique, so am I missing a step?

  2. Turns out, this is because I am assigning the proxy on the model, whereas in this instance, I need to do it on the store.

  3. #2
    Sencha User
    Join Date
    Jun 2007
    Posts
    266
    Answers
    7

    Default

    Turns out, this is because I am assigning the proxy on the model, whereas in this instance, I need to do it on the store.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •