1. #1
    Sencha User
    Join Date
    Aug 2012
    Posts
    11
    Vote Rating
    1
    reselbob is on a distinguished road

      0  

    Default Unanswered: Is it possible to apply different filters to the same share store?

    Unanswered: Is it possible to apply different filters to the same share store?


    Hi:

    I have a store that has a dataset:

    Code:
    [
    {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,
    Bob

  2. #2
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,088
    Answers
    112
    Vote Rating
    95
    Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light

      0  

    Default


    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).

  3. #3
    Sencha User
    Join Date
    Aug 2012
    Posts
    11
    Vote Rating
    1
    reselbob is on a distinguished road

      0  

    Default


    Thank you, Farish.

    Let me try as you suggest.

Thread Participants: 1