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.
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:
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?
I ran into this same problem. My store instances were unique, they each got the same proxy for some reason though. The only way I found to solve this was to include the proxy config when I created the store. The full proxy config had to be included though, here was the actual code:
missingStore = Ext.create('ST.store.Attendance', {
storeId: 'Missing_Attendance',
proxy: {
type: 'ajax',
url: 'query',
extraParams: {
resource: 'Attendance',
parameters: '6'
},
writer: 'pipe'
}
}),
partialStore = Ext.create('ST.store.Attendance', {
storeId: 'Partial_Attendance',
proxy: {
type: 'ajax',
url: 'query',
extraParams: {
resource: 'Attendance',
parameters: '5'
},
writer: 'pipe'
}
}),
attendedStore = Ext.create('ST.store.Attendance', {
storeId: 'Attended_Attendance',
proxy: {
type: 'ajax',
url: 'query',
extraParams: {
resource: 'Attendance',
parameters: '4'
},
writer: 'pipe'
}
}),