在extjs中对存储对象应用多个过滤器
我正在尝试在应用商店上实现多个过滤器。这是我的密码在extjs中对存储对象应用多个过滤器,extjs,Extjs,我正在尝试在应用商店上实现多个过滤器。这是我的密码 var record = hg_mGrid.store.getAt(0); var switch_id_cust_group=record.get("switch_id_cust_group"); hg_nmDs.filter([ {property: 'name', value: userFilterName}, {
var record = hg_mGrid.store.getAt(0);
var switch_id_cust_group=record.get("switch_id_cust_group");
hg_nmDs.filter([
{property: 'name', value: userFilterName},
{property: 'switch_id_cust_group', value: switch_id_cust_group}
]);
hg_nmDs是一个store对象,我想过滤它的数据以获得name和switch_id_cust_group值。我没有得到任何错误,但两个过滤标准都没有应用
我也试过这样做:
var filters=[
new Ext.util.Filter({
filterFn: function(hg_nmGrid){
return hg_nmGrid.get('name') == userFilterName && hg_nmGrid.get('switch_id_cust_group') == switch_id_cust_group;
}
})
];
hg_nmDs.filter(filters);
但在“var filters=[”行中出现错误“SCRIPT445:Object不支持此操作”。请帮助我完成此操作好吗?应用筛选器后,必须加载存储
var filters = new Ext.util.Filter({
filterFn: function(hg_nmGrid){
return hg_nmGrid.get('name') == userFilterName && hg_nmGrid.get('switch_id_cust_group') == switch_id_cust_group;
}
}) ;
store.filter(filters);
store.load(function(){
console.log('Store should be filtered, when this callback function is called');
})
我在声明filter.var filters=[new Ext.util.filter({filterFn:function(hg_nmGrid){return hg_nmGrid.get('name')==userFilterName&&hg_nmGrid.get('switch_id_cust_group')的行中遇到错误“SCRIPT445:Object不支持此操作”==switch_id_cust_group;}}})store.filter('name',userFilterName);store.filter('switch_id_cust_group',switch_id_cust_group);store.load();或者使用一个函数但使用不同的语法执行此操作-没有这些[]括号:var filters=new Ext.util.filter({filterFn:function(hg\u nmGrid){return hg\u nmGrid.get('name')==userFilterName&&hg\u nmGrid.get('switch\u id\u cust\u group')==switch\u id\u cust\u group;});然后应用筛选器…store.filter(longNameFilter)文档: