PDA

View Full Version : How to apply two filters progressively?



sravaniv
18 Jan 2012, 10:57 PM
Urgent help needed!!

Hi guys,

I'm a new bee to extjs and I have a problem.

I have a store and I had filtered the data on one basis and loaded onto a grid.
Now, the problem is I have to filter the filtered data on another basis and count the number of records in it.
How do I filter the filtered data?
Do I have to save the initial filtered data in a variable /object? Is it possible ?

Please help!

Thanks

chramer
19 Jan 2012, 2:18 AM
yeah you can apply multiple filters on stores..


//first filter
store.filter([
{filterFn: function(item) { return item.get("price") < 100; }}
]);

//second filter
store.filter([
{filterFn: function(item) { return item.get("count") > 20; }}
]);

so here the second filter will be applied on the data that was filtered by the first filter!
if you need initial data from the store just use the method

store.clearFilter();

sravaniv
20 Jan 2012, 12:37 AM
Thanks for the reply :)