-
4 Nov 2012 3:52 AM #1
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.

-
Best Answer Posted by hadukiCode:
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; } });
-
4 Nov 2012 5:19 AM #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; } });I write English by translator.
-
4 Nov 2012 7:35 AM #3


Reply With Quote