Extjs一次性后从后台加载数据后还是循环调用子节点数据

环境 Extjs4.2
做tree一次性从后台加载数据的时候,发现返回了数据结构,包含了children子节点结合,前端还是会继续查询每个节点的子节点,最后发现是我这边TreeStore定义有问题,
在这里插入图片描述

这里的root写了是res。但是后台传过来的时候,子节点写的是children。这里将后台返回数据的子节点的名字改成res。就好了
原先定义的是private List children;
后修改为 private List res
在这里插入图片描述
。extjs原文如下。

For the tree to read nested data, the Ext.data.reader.Reader must be configured with a root property, so the reader can find nested data for each node (if a root is not specified, it will default to ‘children’). This will tell the tree to look for any nested tree nodes by the same keyword, i.e., ‘children’. If a root is specified in the config make sure that any nested nodes with children have the same name. Note that setting defaultRootProperty accomplishes the same thing.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值