sencha-touch-2 - 在 sencha touch 中存储过滤器

标签 sencha-touch-2

我有具有结构的商店:

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/

相关文章:

javascript - 幻灯片效果不工作

extjs - Ext.Define 中的 Sencha touch 2 事件监听器

audio - 添加到主屏幕后无法播放音频-Sencha Touch

sencha-touch-2 - 为什么 Sencha Touch cmd 中没有 View 构建

javascript - sencha touch2 中的加载掩码

javascript - PhoneGap/ Cordova 2.3。 : how to open all external links in InAppBrowser?

javascript - Sencha Touch 2 安卓性能

google-chrome - HTTP 选项飞行前请求加载已取消,Chrome 中处于待处理状态

javascript - Ext.mixin.Observable.on()/.un() : function reference not matching

sencha-touch - compass - 获取生成的 Sprite 图的宽度和高度