Reputation: 16841
I am loading values from a Store, and then filtering it with a condition (for example name == Matt
). The code is shown below;
var store = Ext.getStore('mystore');
store.on('load', function() {
store.filter({
filterFn: function(rec) {
return Ext.Array.indexOf(arr, rec.get('name')) > -1;
}
});
});
store.load();
Later on, in another view, i need to use the filtered result (shown above) and filter it against another array of values. How can i do this;
My approach was to load the records again (Paste the above code again - but without the filter part of it). But this is incorrect. So how can i Filter results from the previously filtered result array ?
Upvotes: 1
Views: 3565
Reputation: 17000
You can define filters to run on store load in its filters
property and setting filterOnLoad
property to true
.
To filter records against new filter conditions:
store.clearFilter(true); // Clears old filters
store.filter([
{
filterFn: function(rec) {
return Ext.Array.indexOf(arr, rec.get('name')) > -1;
}
}
]);
Upvotes: 3