Extjs 将存储筛选器加载到多个列表

Extjs 将存储筛选器加载到多个列表,extjs,sencha-touch,sencha-touch-2,sencha-touch-2.1,Extjs,Sencha Touch,Sencha Touch 2,Sencha Touch 2.1,我在一个视图中有三个列表。我需要根据这些列表筛选存储。当我尝试加载存储时,所有三个列表都会显示相同的数据 这是我试过的代码 var SStore = Ext.getStore('mystore'); SStore.clearFilter(true); SStore.filter('status', '1'); Ext.getCmp('list1').setStore(SStore); var BStore = Ext.getStore('mystore'); BStore.clear

我在一个视图中有三个列表。我需要根据这些列表筛选存储。当我尝试加载存储时,所有三个列表都会显示相同的数据

这是我试过的代码

var SStore = Ext.getStore('mystore');

SStore.clearFilter(true);


SStore.filter('status', '1');

Ext.getCmp('list1').setStore(SStore);

var BStore = Ext.getStore('mystore');

BStore.clearFilter(true);

BStore.filter('sattus', '2');

Ext.getCmp('bluetbl').setStore(BStore);

var RStore = Ext.getStore('mystore');

RStore.clearFilter(true);

RStore.filter('status', '3');

Ext.getCmp('redtbl').setStore(RStore);

请帮我找出解决方案。

每次你调用Ext.getStore('mystore');你得到的是商店的相同实例,而不是副本。这意味着您的所有表都将与上次应用的筛选器共享同一存储。您应该为每个网格使用不同的存储。差不多

var SStore = Ext.getStore('mystore');

SStore.clearFilter(true);

SStore.filter('status', '1');

// ATTENTION Ext.getCmp('list1').setStore(SStore); the setStore method doesn't exist!

// instead you have to create your grid with SStore as store

var grid = new Ext.grid.GridPanel({store: SStore, autoLoad: false});
//autoLoad: false gives you control of the load


SStore.load(); // now the first grid gets populated



var BStore = Ext.getStore('mySecondStore');

BStore.clearFilter(true);

BStore.filter('status', '2'); //check the spelling of status

//Ext.getCmp('bluetbl').setStore(BStore); no..

//create your bluetbl grid with BStore as store

var secondGrid = new Ext.grid.GridPanel({store: BStore, autoLoad: false});
//autoLoad: false gives you control of the load


BStore.load(); // now the second grid gets populated

那么我怎样才能将数据从一个存储区过滤到多个列表呢?我的建议是使用多个存储区。您可以从服务器读取一次数据,然后使用storeN.loadData(数据)填充网格