0
我創建了一個模型結構如下:從Sencha Touch的Store中獲得特定價值?
型號代碼:
Ext.define('MyApp.model.FavoriteScreen', {
extend: 'Ext.data.Model',
config: {
fields: [
{
name: 'Name'
},
{
name: 'ScreenId'
}
]
}
});
而且我已經創建了一個存儲與結構如下:
店內碼:
Ext.define('MyApp.store.FavoriteStore', {
extend: 'Ext.data.Store',
requires: [
'MyApp.model.FavoriteScreen'
],
config: {
autoLoad: true,
model: 'MyApp.model.FavoriteScreen',
storeId: 'FavStore',
proxy: {
type: 'ajax',
api: {
read: '/api/sample/FavoriteList'
},
headers: {
'Content-Type': 'application/json; charset=UTF-8'
},
reader: {
type: 'json',
rootProperty: 'data'
}
}
}
});
現在我想從這家商店得到特定的記錄,但我的商店沒有返回任何價值。要想從商店,我已經寫的代碼下面一行值:
var myStore = Ext.getStore('FavStore');
myStore.load({
scope: this,
callback: function (records, operation, success) {
if (success) {
Ext.Msg.alert(myStore.getAt(0).getData());
}
}
});
上面的代碼我已經寫在上面的代碼我已經寫上nestedlistleafitemtap事件。
任何幫助表示讚賞!
在回調函數中,你能看到'records'參數中有什麼嗎? – ThinkFloyd