没有子节点的节点错误地加载了整颗树
@zTree 你好,想跟你请教个问题:
ajax加载节点.没有子节点的节点会把整颗树又放到它自己之下.
用静态数据初始化是好的,没有时间仔细去看.请问有无遇到过类似问题?
下面是数据
- 38: {pId:0, id:160, deviceid:0, name:设备ID, isParent:1}
- 34: {pId:0, id:58, deviceid:0, name:组组组组组组组7, isParent:1}
- 0: {pId:1, sn:000001045, id:2, name:sb_000001045, deviceid:20}
- 1: {pId:1, sn:1478887464234567, id:2, name:熊dddd, deviceid:21}
- 2: {pId:1, sn:000001031, id:2, name:000001031, deviceid:22}
- 3: {pId:1, sn:000001051, id:2, name:000001051, deviceid:23}
- 4: {pId:1, sn:000001022, id:2, name:000001022, deviceid:24}
- 5: {pId:1, sn:8019810417000007, id:2, name:双驰科技007, deviceid:40}
- 6: {pId:1, sn:80010010, id:2, name:80010010, deviceid:43}
- 7: {pId:1, sn:000001055, id:2, name:000001055, deviceid:29}
- 8: {pId:1, sn:000001056, id:2, name:000001056, deviceid:30}
- 9: {pId:1, sn:2508010007018701, id:2, name:test_01_qin, deviceid:37}
- 10: {pId:1, sn:2508010007016671, id:2, name:2508010007016671, deviceid:35}
- 11: {pId:1, sn:A178011218A0352417, id:2, name:A178011218A0352417, deviceid:42}
- 12: {pId:1, sn:8019810417000009, id:2, name:深圳神秾(一), deviceid:55}
- 13: {pId:1, sn:8019810417000010, id:2, name:深圳神秾(二), deviceid:56}
- 14: {pId:1, sn:8019810417000011, id:2, name:厦门锐谷, deviceid:58}
- 15: {pId:1, sn:8019810417000012, id:2, name:埃晶龚辉(一), deviceid:59}
- 16: {pId:1, sn:8019810417000013, id:2, name:埃晶龚辉(二), deviceid:60}
- 17: {pId:1, sn:80010012, id:2, name:80010012, deviceid:45}
- 18: {pId:1, sn:80010016, id:2, name:80010016, deviceid:49}
- 19: {pId:1, sn:8019810417000018, id:2, name:双驰科技018, deviceid:70}
- 20: {pId:1, sn:8019810417000019, id:2, name:双驰科技019, deviceid:71}
- 21: {pId:1, sn:80010014, id:2, name:80010014, deviceid:47}
- 22: {pId:1, sn:80010015, id:2, name:80010015, deviceid:48}
- 23: {pId:1, sn:80010018, id:2, name:80010018, deviceid:51}
- 24: {pId:1, sn:80010019, id:2, name:80010019, deviceid:52}
- 25: {pId:1, sn:01234567890123456, id:2, name:熊假, deviceid:78}
- 26: {pId:1, sn:222, id:2, name:什么, deviceid:85}
- 27: {pId:0, isParent:1, name:所有设备, id:1}
- 28: {pId:0, id:42, deviceid:0, name:组组组, isParent:1}
- 29: {pId:0, id:47, deviceid:0, name:组组2, isParent:1}
- 30: {pId:0, id:51, deviceid:0, name:组组组组组3, isParent:1}
- 31: {pId:0, id:55, deviceid:0, name:组组, isParent:1}
- 32: {pId:0, id:56, deviceid:0, name:组组组组组组组组组组5, isParent:1}
- 33: {pId:0, id:57, deviceid:0, name:666, isParent:1}
- 34: {pId:0, id:58, deviceid:0, name:组组组组组组组7, isParent:1}
- 35: {pId:0, id:59, deviceid:0, name:组组组组组组8组组, isParent:1}
- 36: {pId:0, id:60, deviceid:0, name:组组组组999组组组组组组组组组组组组9, isParent:1}
- 37: {pId:0, id:61, deviceid:0, name:组组组组组组组组组10, isParent:1}
- 38: {pId:0, id:160, deviceid:0, name:设备ID, isParent:1}
- 39: {pId:0, id:163, deviceid:0, name:ddd, isParent:1}
- 40: {pId:42, sn:1478887464234567, id:44, deviceid:21, name:熊dddd, isParent:0}
- 41: {pId:42, sn:000001031, id:45, deviceid:22, name:000001031, isParent:0}
- 42: {pId:42, sn:000001051, id:46, deviceid:23, name:000001051, isParent:0}
- 43: {pId:47, sn:000001022, id:48, deviceid:24, name:000001022, isParent:0}
- 44: {pId:47, sn:000001051, id:50, deviceid:23, name:000001051, isParent:0}
- 45: {pId:51, sn:1478887464234567, id:52, deviceid:21, name:熊dddd, isParent:0}
- 46: {pId:51, sn:000001031, id:53, deviceid:22, name:000001031, isParent:0}
- 47: {pId:51, sn:000001051, id:54, deviceid:23, name:000001051, isParent:0}
- 48: {pId:55, sn:1478887464234567, id:62, deviceid:21, name:熊dddd, isParent:0}
- 49: {pId:55, sn:000001031, id:63, deviceid:22, name:000001031, isParent:0}
- 50: {pId:55, sn:000001051, id:64, deviceid:23, name:000001051, isParent:0}
- 51: {pId:56, sn:000001031, id:65, deviceid:22, name:000001031, isParent:0}
- 52: {pId:57, sn:000001051, id:66, deviceid:23, name:000001051, isParent:0}
- 53: {pId:59, sn:000001022, id:68, deviceid:24, name:000001022, isParent:0}
- 54: {pId:61, sn:000001045, id:70, deviceid:20, name:sb_000001045, isParent:0}
- 55: {pId:42, sn:80010017, id:142, deviceid:50, name:80010017, isParent:0}
- 56: {pId:42, sn:000001022, id:146, deviceid:24, name:000001022, isParent:0}
- 57: {pId:47, sn:1478887464234567, id:147, deviceid:21, name:熊dddd, isParent:0}
- 58: {pId:60, sn:000001022, id:164, deviceid:24, name:000001022, isParent:0}
- 59: {pId:60, sn:80010012, id:165, deviceid:45, name:80010012, isParent:0}
- 60: {pId:163, sn:000001022, id:166, deviceid:24, name:000001022, isParent:0}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
1、保证展开的节点,能把该节点的 id 传给后台获取
2、保证后台生成数据时,能根据 接收到的 id 进行处理
3、利用 beforeAsync 可以控制哪些父节点不进行异步记载的处理
ajax请求返回的数据必须不是整棵树的数据,而是以当前展开节点的id为父节点id的数据。
小数据也是这样,每次展开问题节点,都会发起ajax请求数据。是否是bug?
{pId:"1",sn:"000001045",id:"2",name:"sb_000001045",deviceid:20},
{pId:"1",sn:"1478887464234567",id:"2",name:"熊dddd",deviceid:21},
{pId:"1",sn:"000001031",id:"2",name:"000001031",deviceid:22},
{pId:"1",sn:"000001051",id:"2",name:"000001051",deviceid:23},
{pId:"1",sn:"000001022",id:"2",name:"000001022",deviceid:24},
{pId:0,isParent:1,name:"所有设备","id":1},
{pId:0,id:80,deviceid:0,name:"gg",isParent:1},
{pId:0,id:81,deviceid:0,name:"gg",isParent:1}