我有具有结构的商店:
Ext.create('Ext.data.Store', {
fields: [
'title'
],
data: [{
title: 'ABC'
}, {
title: 'ABC2'
}, {
title: 'ABC3'
}, {
title: 'ABC4'
}, {
title: 'ABC5'
}, {
title: 'ABC6'
}]
});
因此,当我加载此商店列表时,会填充所有 6 条记录。
我只是想在单击按钮时过滤这家商店我只是想从这 6 条记录中获取一些选定的记录,这可能吗?
向我提供一些想法或工作代码。
最佳答案
根据标题过滤商店
Ext.getStore('storeId').filter("title", "ABC3");
清除过滤器
Ext.getStore('storeId').clearFilter();
查看店铺 filter文档
更新
Ext.getStore('storeId').filterBy(function(record){
var title = record.get('title');
if(title == "ABC" || title == "ABC1" || title == "ABC2")
return record;
});
关于sencha-touch-2 - 在 sencha touch 中存储过滤器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18606212/