【发布时间】:2011-04-21 23:38:54
【问题描述】:
我的 JsonStore 似乎没有填充。当我运行代码时,它会触发请求,该请求会返回 json。当我检查数据存储时,数据数组是空的。
我错过了什么?谢谢。
我定义了这个 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'));
});
}
}
});
试图将它绑定到这个 Ext.List
CCList.listPanel = new Ext.List({
id: 'indexList',
store: CCList.ListStore,
itemTpl: '<div class="costcenter">{Id}-{Description}</div>'
}
});
我的网址返回这个 json:
{ "rows" : [
{ "Description" : "Jason",
"Id" : "100"
},
{ "Description" : "Andrew",
"Id" : "200"
}
] }
【问题讨论】:
标签: c# json extjs sencha-touch