1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    25
    Vote Rating
    3
    amfailla is on a distinguished road

      0  

    Default Answered: Filter JSON array object in Store

    Answered: Filter JSON array object in Store


    Hi

    I have a JSON store and one of my fields in my model is an Array.

    When i filter using myStore.filter("myArray","mySearchText") it doesn't filter for all the items in the Array.

    How can i filter through each of the elements contained in the array?

    It's probably so easy so, sorry for the noobish question but I am pretty new to sencha.


    Many Thanks in advance.

  2. Code:
    store.filterBy(function(record,id){
        var array = record.get('arrayFieldName');
        if(Ext.isArray(array)){
            for(var i = 0; i < array.length; i++){
                 if(array[i]==what you want){
                    return true;
                 }
            }
            return false;
        }else{
            return false;
        }
    });

  3. #2
    Sencha User
    Join Date
    Apr 2010
    Location
    China
    Posts
    227
    Answers
    64
    Vote Rating
    20
    haduki will become famous soon enough haduki will become famous soon enough

      0  

    Default


    Code:
    store.filterBy(function(record,id){
        var array = record.get('arrayFieldName');
        if(Ext.isArray(array)){
            for(var i = 0; i < array.length; i++){
                 if(array[i]==what you want){
                    return true;
                 }
            }
            return false;
        }else{
            return false;
        }
    });
    I write English by translator.

  4. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    25
    Vote Rating
    3
    amfailla is on a distinguished road

      0  

    Default


    thanks this works great

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi