I saw this question and I want to go a step further https://stackoverflow.com/questions/18606212/store-filter-in-sencha-touch#=
First I filter that table (this is working so far):
Then I will filter another table depending on the filter of the first table.
And now I tested something like:
TABLEVIEWSTORE1.filter("name", name);
TABLEVIEWSTORE1.load({callback: function (){
tableviewstore2.load({callback: function (){
TABLEVIEWSTORE1.each(function(item){
tableviewstore2.filterBy(function(record,id){
return record.get("number") == item.get("number");
}, this);
});
TABLEVIEWSTORE1.load({callback: function (){
tableviewstore2.load({callback: function (){
// DO MORE THINGS
}});
}});
}});
}});
});
Has anyone an idea how it can be working properly?
Firstly we should find all the unique numbers from the first filtered store.
Then, we should filter the second store based on those unique numbers array.
We will use Ext.Array
for this.
var uniqueNumbers= [];
TABLEVIEWSTORE1.each(function(item){
Ext.Array.include(uniqueNumbers,item);
});
tableviewstore2.filterBy(function(record){
return Ext.Array.contains(uniqueNumbers,record.get("number"));
});