Extjs:按数组过滤存储

时间:2014-11-25 13:31:22

标签: extjs

我想按数组过滤store而不仅仅是单个值,我使用filterBy,但它不起作用。你能帮帮我吗?

       var properties = rec.get('properties').split(',');

       var store = this.getPropertyStore().load();
           store.clearFilter(false);
           store.filterBy(function(record, id) {
               return Ext.Array.contains(properties, record.get("idProperty"));

           });

1 个答案:

答案 0 :(得分:0)

加载是异步的,将过滤器放入加载事件:

var store = this.getPropertyStore().load();
    store.clearFilter(false);
    store.on('load',function(){
        store.filterBy(function(record, id) {
            return Ext.Array.contains(properties, record.get("idProperty"));
        });
    })