Monday, 19 August 2013

How to find value from Store on the basis of two key in Sencha Touch?

How to find value from Store on the basis of two key in Sencha Touch?

Suppose that I've a store containing following model structure:
Ext.define('MyApp.model.FavoriteScreen', {
extend: 'Ext.data.Model',
config: {
fields: [
{
name: 'Id',
type: 'int'
},
{
name: 'Key1'
},
{
name: 'Key2'
},
{
name: 'Key3'
},
{
name: 'Key4'
}
]
}
});
Now to find the value from store according to key1, I've written following
line of code:
var favoritStore = Ext.data.StoreManager.lookup('FavoriteStore'),
index = favoritStore.find('Key1',key_value),
filterValue = index != -1 ? favoritStore.getAt(index) : null;
Its working fine. But I want to get value from store on the basis of two
keys (i.e key1 & key2) But I don't have idea how to do this. Please give
me appropriate solution.

No comments:

Post a Comment