Extjs4.0.7 树加载TypeError: records[i] is undefined [在此错误处中断] ns[i].viewRecordId

在使用ExtJS4.0.7时,遇到树加载问题,TypeError提示records[i] is undefined。问题出现在后台返回JSON树数据后,尝试展开根节点时,树形数据store无法正确处理数据导致。store定义中,数据源类型为ajax,URL指向特定action,reader设置为json,但加载数据时出现异常。期望获得解决方案。

后台返回的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  并报错  希望能给个解答

 

TypeError: records[i] is undefined
Error: Permission denied to access property 'toString'
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值