我有一个商店APP.store.Posts
,我想实例化3个不同的时间。它们都将保存相同类型的数据,但在重新加载,分页等时将使用不同的参数。在控制器中,我在onLaunch
函数中执行此操作。在Ext.data.Store上使用storeId没有创建唯一的实例
onLaunch: function() {
Ext.create('APP.store.Posts',{
storeId: 'unclassifiedPosts'
});
Ext.create('APP.store.Posts',{
storeId: 'positivePosts'
});
Ext.create('APP.store.Posts',{
storeId: 'negativePosts'
});
},
后来的后来,在我的控制器上创建的beforerender
监听方法,我这样做:
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
},
的问题是,无论beforerrender
网格最后呼吁,所有的3家商店有这些参数。所以最初的加载是好的,但如果我做任何刷新,分页等等。它们都显示相同的数据B/C每个商店的代理具有相同的extraParams。
从我所了解的情况来看,storeId
参数应该让我的商店独一无二,所以我错过了一个步骤?
代理是否在'APP.store.Posts'或其包含的模型上定义? – 2012-07-20 15:24:01
代理在模型上定义。没有认为这会是一个问题,但这是有道理的。 – Nathan 2012-07-20 15:35:37