2
我的JsonStore似乎沒有填充。當我運行代碼時,它會關閉請求,並返回json。當我檢查數據存儲時,數據數組是空的。ExtJS JsonStore未填充
我缺少什麼?謝謝。
我有這個JsonStore定義:
CCList.ListStore = new Ext.data.JsonStore({
root: 'rows',
idProperty: 'Id',
fields: ['Id', 'Description'],
autoLoad: true,
proxy: new Ext.data.HttpProxy({
method: 'GET',
url: '/costcenters/getjson'
}),
listeners: {
load: function (obj, records) {
Ext.each(records, function (rec) {
console.log(rec.get('Id'));
});
}
}
});
試圖把它這個JSON綁定到這個Ext.List
CCList.listPanel = new Ext.List({
id: 'indexList',
store: CCList.ListStore,
itemTpl: '<div class="costcenter">{Id}-{Description}</div>'
}
});
我的網址回報:
{ "rows" : [
{ "Description" : "Jason",
"Id" : "100"
},
{ "Description" : "Andrew",
"Id" : "200"
}
] }
非常感謝您。 JsonStore也不適用於Sencha Touch嗎? – 2011-04-22 03:05:54
它就在那裏,但數據包的工作方式現在有點多餘,你最好堅持我上面概述的方法。 – 2011-04-22 03:27:06