Reputation: 1
I am trying to implement multiple filters on store. Here is my code
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 is a store object, I want to filter its data for name and switch_id_cust_group values. I am not getting any error but none of the two filter criterias are applied.
I also tried this way:
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);
But face error "SCRIPT445: Object doesn't support this action " for line "var filters=[". Could you please help me to get this done?
Upvotes: 0
Views: 2290
Reputation: 59
You have to load the store after you apply the filter.
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');
})
Upvotes: 1