1. #1
    Sencha User
    Join Date
    Feb 2012
    Location
    Munich, Germany
    Posts
    57
    Vote Rating
    1
    kodak is on a distinguished road

      0  

    Default Unanswered: howto filter store from a list

    Unanswered: howto filter store from a list


    Hi!

    Iam trying to apply several filter which I get from a localStorage store.

    I load the store and can apply some filters:

    Code:
    var newsStore = Ext.getStore("cityStore");
    
    newsStore.filter(Ext.create('Ext.util.Filter', {
        filterFn: function(item) {
            return item.get('name') == 'city1' || item.get('name') == 'city2';  
    }
        }));
    But now I have a list of items and would like to iterate through all items in the list and apply them to the store filter.

    The problem is imho that I cannot iterate though a loop and do return item.get('name') == 'variable' again and again because this would only filter for the last return but I would like to apply every item in the list as the filter seen above.

    Hope I can find some help here...

    Thanks!

  2. #2
    Sencha User
    Join Date
    Nov 2012
    Location
    Netherlands
    Posts
    50
    Answers
    6
    Vote Rating
    1
    eastlander is on a distinguished road

      0  

    Default


    Code:
    filterFn: function (item) {
        for (var i = 0; i < myFilters.length; i++) {
            if (item.get('name') == myFilters[i]) return true;
        }
    
    
        return false;
    }

Thread Participants: 1

Tags for this Thread