View Full Version : Is it possible to apply different filters to the same share store?

23 Oct 2012, 8:34 PM

I have a store that has a dataset:

{category:color, value:red},
{category:color, value:green},
{category:risk, value:high},
{category:color, value:blue},
{category:risk, value:low}

I want two comboboxes to share the store data. One combo I hope to filter by {category:color}, the other {category:risk}.

Is such filtering on a shared store possible? If so, how?

Thanks in advance,

23 Oct 2012, 10:52 PM
filter is a property of the store and as far as i know, what you want to do is not possible. if you use store.filter() twice with different values, it will filter the store by both values.

one solution could be to clearFilter() when the combobox is opened (combo expand event) and then apply the filter you want for that combobox.

another solution would be to copy the store records into another store when your store is loaded and then use the two separate stores with separate filters. this would save you from loading two stores from the server (you only need one request).

24 Oct 2012, 11:48 AM
Thank you, Farish.

Let me try as you suggest.