如何一次过滤具有多个值的商店? [英] How to filter a store with multiple values at once?

查看:106
本文介绍了如何一次过滤具有多个值的商店?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个商店附加到一个具有记录数的网格。我有一个包含mulitiSelect选项的组合框。所以每当我在组合框中选择多个值。必须使用提供的所有标准过滤网格。我可以从组合框中获取值作为逗号分隔值,但无法将其发送到存储的过滤器配置。



请帮助!



谢谢!

解决方案

有点清洁:

  var store = grid.getStore(); 
var selectedItems = csvList.split(,); //您的逗号分隔值列表
store.clearFilter();
store.filterBy(function(record,id){
return Ext.Array.indexOf(selectedItems,record.get(value))!== -1;
} );


I have a Store attached to a grid with number of records. I have a combo box with mulitiSelect option. So whenever i select multiple values in the Combo box. the grid must be filtered with all the criteria provided. I can get the values from the combo box as comma separated values but unable to send them to store's filter config.

Please Help!

Thanks!

解决方案

A bit cleaner:

var store = grid.getStore();
var selectedItems = csvList.split(","); //your list of comma separated values
store.clearFilter();
store.filterBy(function(record, id){
    return Ext.Array.indexOf(selectedItems, record.get("value")) !== -1;
}, this);

这篇关于如何一次过滤具有多个值的商店?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆