PDA

View Full Version : Store Looping



karthikbr1
16 May 2012, 8:49 PM
Hi
Iam trying to create newstore from available store like shown below

function subStore(fieldLabel)
{

var newStore=new Ext.create('Ext.data.Store',{
fields:['key','value'],
id:'SplitOrderFilterStore_'+fieldLabel
});

quoteStatusCountryStore.data.each(function(item, index, totalItems) {
quoteStatusCountryStore.filter(function(storeField) {
var field = storeField.get('key');
if (field == fieldLabel){
newStore.add(quoteStatusCountryStore.data.items[index]);
}
});

});

return newStore;
}
The problem is that after the loop of quoteStatusCountryStore.data.each(function(item, index, totalItems) {.....} the quoteStatusCountryStore becomes empty...Pls kindly help...

chesstrix
16 May 2012, 11:16 PM
I can't for the life of me work out what you're trying to do here but I do know if you want to filter a store using a function you need to use filterBy() not filter()