后台返回的json树 struts2 返回
{
"lists":[
{
"children":[
{
"children":[
],
"cls":null,
"id":"ptxh",
"leaf":true,
"parentId":"root",
"text":"普通笑话",
"type":0
},
{
"children":[
],
"cls":null,
"id":"crxh",
"leaf":true,
"parentId":"root",
"text":"成人笑话",
"type":2
},
{
"children":[
],
"cls":null,
"id":"qs",
"leaf":true,
"parentId":"root",
"text":"糗事",
"type":3
},
{
"children":[
],
"cls":null,
"id":"lxh",
"leaf":true,
"parentId":"root",
"text":"冷笑话",
"type":1
}
],
"cls":null,
"id":"root",
"leaf":false,
"parentId":null,
"text":"根节点",
"type":null
}
]
}
store的定义
Ext.define('AM.store.JokeStore4Tree',{
extend:'Ext.data.TreeStore',
model:'AM.model.JokeModel4Tree',
defaultRootId:'lists',
proxy:{
type:'ajax',
url:'AppMenu/menu!list',
actionMethods:'POST',
reader:{
type:'json',
root:'lists'
}
},
autoLoad:true
})
点击根节点的+号后会再次向后台发请求 请求action 为store里面的url
继续返回上面的json 并报错 希望能给个解答
在使用ExtJS4.0.7时,遇到树加载问题,TypeError提示records[i] is undefined。问题出现在后台返回JSON树数据后,尝试展开根节点时,树形数据store无法正确处理数据导致。store定义中,数据源类型为ajax,URL指向特定action,reader设置为json,但加载数据时出现异常。期望获得解决方案。

758

被折叠的 条评论
为什么被折叠?



