我的Store是这么定义的:
Ext.define("NP.store.Menus", {
extend : "Ext.data.TreeStore",
model : "NP.model.Menu",
root : {
expanded : true,
text : "系统菜单",
},
proxy : {
type : "rest",
url : "menu",
reader : {
type : "json",
root : "data",//这里如果设置成data.content就不对
successProperty : "success"
}
}
});
服务器返回的JSON数据格式为:
{
"data": {
"content": [
{
"id": 1,
"name": "系统管理",
"url": null,
"title": "系统管理",
"icon": null,
"parent": null,
"children": [],
"roles": [],
"userGroups": []
}
]
},
"success": true
}
因为我的模型数据集合是在数据的data.content里,而如果Store.proxy.reader.root设置成data.content 就会报错:Uncaught TypeError: Cannot read property 'content' of undefined
这是什么原因啊 ? 请指点啊