我正在ExtJS 4.0上工作,我想在网格中显示嵌套的JSON数据。为此,我使用Ext.data.reader.Reader
docs, "Loading Nested Data"中给出的示例。这很好,很简单,但现在我想在网格中显示这些数据。我该如何设置dataIndex
?如何在EXTJS 4网格中显示嵌套的Json数据?
这是我的样本模型和存储:
Ext.define("data", {
extend: 'Ext.data.Model',
fields: ['year', 'state'],
hasMany: {
model: 'record',
name: 'record'
},
proxy: {
type: 'rest',
url: 'Column.json.php',
reader: {
type: 'json',
root: 'data'
}
}
});
Ext.define("record", {
extend: 'Ext.data.Model',
fields: ['id', 'autorization', 'expendture'],
belongsTo: 'User'
});
var store1 = new Ext.data.Store({
model: "data"
});
我的JSON:
{
"data": [{
"year": "2010",
"state": "MP",
"record": [{
"id": "auth",
"autorization": "9.201"
}, {
"id": "exp",
"expendture": "1.250"
}]
}]
}
我想读autorization
和expendture
与id
“它可能更快在Sencha论坛上提问“,具有讽刺意味的是,我通过Sencha论坛的链接发现了这个问题。 – 2012-05-16 14:05:46
你能在这个答案中提供更多信息吗?一旦使用此处列出的映射列表,如何定义网格? – 2012-05-30 19:38:13