假设我有一个包含以下模型结构的商店:
Ext.define('MyApp.model.FavoriteScreen', {
extend: 'Ext.data.Model',
config: {
fields: [
{
name: 'Id',
type: 'int'
},
{
name: 'Key1'
},
{
name: 'Key2'
},
{
name: 'Key3'
},
{
name: 'Key4'
}
]
}
});
现在要根据 key1 从 store 中找到值,我编写了以下代码行:
var favoritStore = Ext.data.StoreManager.lookup('FavoriteStore'),
index = favoritStore.find('Key1',key_value),
filterValue = index != -1 ? favoritStore.getAt(index) : null;
它工作正常。但我想根据两个键(即 key1 和 key2)从商店中获取价值,但我不知道如何做到这一点。请给我适当的解决方案。