没有子节点的节点错误地加载了整颗树

发布于 2021-11-24 21:54:14 字数 5589 浏览 674 评论 3

@zTree 你好,想跟你请教个问题:

ajax加载节点.没有子节点的节点会把整颗树又放到它自己之下.

用静态数据初始化是好的,没有时间仔细去看.请问有无遇到过类似问题?

下面是数据

  1. 38: {pId:0, id:160, deviceid:0, name:设备ID, isParent:1}
  1. 34: {pId:0, id:58, deviceid:0, name:组组组组组组组7, isParent:1}
这两个节点下面又加载了整颗树,其他有子节点的节点是好的.

  1. 0: {pId:1, sn:000001045, id:2, name:sb_000001045, deviceid:20}
  2. 1: {pId:1, sn:1478887464234567, id:2, name:熊dddd, deviceid:21}
  3. 2: {pId:1, sn:000001031, id:2, name:000001031, deviceid:22}
  4. 3: {pId:1, sn:000001051, id:2, name:000001051, deviceid:23}
  5. 4: {pId:1, sn:000001022, id:2, name:000001022, deviceid:24}
  6. 5: {pId:1, sn:8019810417000007, id:2, name:双驰科技007, deviceid:40}
  7. 6: {pId:1, sn:80010010, id:2, name:80010010, deviceid:43}
  8. 7: {pId:1, sn:000001055, id:2, name:000001055, deviceid:29}
  9. 8: {pId:1, sn:000001056, id:2, name:000001056, deviceid:30}
  10. 9: {pId:1, sn:2508010007018701, id:2, name:test_01_qin, deviceid:37}
  11. 10: {pId:1, sn:2508010007016671, id:2, name:2508010007016671, deviceid:35}
  12. 11: {pId:1, sn:A178011218A0352417, id:2, name:A178011218A0352417, deviceid:42}
  13. 12: {pId:1, sn:8019810417000009, id:2, name:深圳神秾(一), deviceid:55}
  14. 13: {pId:1, sn:8019810417000010, id:2, name:深圳神秾(二), deviceid:56}
  15. 14: {pId:1, sn:8019810417000011, id:2, name:厦门锐谷, deviceid:58}
  16. 15: {pId:1, sn:8019810417000012, id:2, name:埃晶龚辉(一), deviceid:59}
  17. 16: {pId:1, sn:8019810417000013, id:2, name:埃晶龚辉(二), deviceid:60}
  18. 17: {pId:1, sn:80010012, id:2, name:80010012, deviceid:45}
  19. 18: {pId:1, sn:80010016, id:2, name:80010016, deviceid:49}
  20. 19: {pId:1, sn:8019810417000018, id:2, name:双驰科技018, deviceid:70}
  21. 20: {pId:1, sn:8019810417000019, id:2, name:双驰科技019, deviceid:71}
  22. 21: {pId:1, sn:80010014, id:2, name:80010014, deviceid:47}
  23. 22: {pId:1, sn:80010015, id:2, name:80010015, deviceid:48}
  24. 23: {pId:1, sn:80010018, id:2, name:80010018, deviceid:51}
  25. 24: {pId:1, sn:80010019, id:2, name:80010019, deviceid:52}
  26. 25: {pId:1, sn:01234567890123456, id:2, name:熊假, deviceid:78}
  27. 26: {pId:1, sn:222, id:2, name:什么, deviceid:85}
  28. 27: {pId:0, isParent:1, name:所有设备, id:1}
  29. 28: {pId:0, id:42, deviceid:0, name:组组组, isParent:1}
  30. 29: {pId:0, id:47, deviceid:0, name:组组2, isParent:1}
  31. 30: {pId:0, id:51, deviceid:0, name:组组组组组3, isParent:1}
  32. 31: {pId:0, id:55, deviceid:0, name:组组, isParent:1}
  33. 32: {pId:0, id:56, deviceid:0, name:组组组组组组组组组组5, isParent:1}
  34. 33: {pId:0, id:57, deviceid:0, name:666, isParent:1}
  35. 34: {pId:0, id:58, deviceid:0, name:组组组组组组组7, isParent:1}
  36. 35: {pId:0, id:59, deviceid:0, name:组组组组组组8组组, isParent:1}
  37. 36: {pId:0, id:60, deviceid:0, name:组组组组999组组组组组组组组组组组组9, isParent:1}
  38. 37: {pId:0, id:61, deviceid:0, name:组组组组组组组组组10, isParent:1}
  39. 38: {pId:0, id:160, deviceid:0, name:设备ID, isParent:1}
  40. 39: {pId:0, id:163, deviceid:0, name:ddd, isParent:1}
  41. 40: {pId:42, sn:1478887464234567, id:44, deviceid:21, name:熊dddd, isParent:0}
  42. 41: {pId:42, sn:000001031, id:45, deviceid:22, name:000001031, isParent:0}
  43. 42: {pId:42, sn:000001051, id:46, deviceid:23, name:000001051, isParent:0}
  44. 43: {pId:47, sn:000001022, id:48, deviceid:24, name:000001022, isParent:0}
  45. 44: {pId:47, sn:000001051, id:50, deviceid:23, name:000001051, isParent:0}
  46. 45: {pId:51, sn:1478887464234567, id:52, deviceid:21, name:熊dddd, isParent:0}
  47. 46: {pId:51, sn:000001031, id:53, deviceid:22, name:000001031, isParent:0}
  48. 47: {pId:51, sn:000001051, id:54, deviceid:23, name:000001051, isParent:0}
  49. 48: {pId:55, sn:1478887464234567, id:62, deviceid:21, name:熊dddd, isParent:0}
  50. 49: {pId:55, sn:000001031, id:63, deviceid:22, name:000001031, isParent:0}
  51. 50: {pId:55, sn:000001051, id:64, deviceid:23, name:000001051, isParent:0}
  52. 51: {pId:56, sn:000001031, id:65, deviceid:22, name:000001031, isParent:0}
  53. 52: {pId:57, sn:000001051, id:66, deviceid:23, name:000001051, isParent:0}
  54. 53: {pId:59, sn:000001022, id:68, deviceid:24, name:000001022, isParent:0}
  55. 54: {pId:61, sn:000001045, id:70, deviceid:20, name:sb_000001045, isParent:0}
  56. 55: {pId:42, sn:80010017, id:142, deviceid:50, name:80010017, isParent:0}
  57. 56: {pId:42, sn:000001022, id:146, deviceid:24, name:000001022, isParent:0}
  58. 57: {pId:47, sn:1478887464234567, id:147, deviceid:21, name:熊dddd, isParent:0}
  59. 58: {pId:60, sn:000001022, id:164, deviceid:24, name:000001022, isParent:0}
  60. 59: {pId:60, sn:80010012, id:165, deviceid:45, name:80010012, isParent:0}
  61. 60: {pId:163, sn:000001022, id:166, deviceid:24, name:000001022, isParent:0}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

白龙吟 2021-11-28 15:28:52

1、保证展开的节点,能把该节点的 id 传给后台获取

2、保证后台生成数据时,能根据 接收到的 id 进行处理

3、利用 beforeAsync 可以控制哪些父节点不进行异步记载的处理

南汐寒笙箫 2021-11-28 07:12:29

ajax请求返回的数据必须不是整棵树的数据,而是以当前展开节点的id为父节点id的数据。

终止放荡 2021-11-27 09:59:48

小数据也是这样,每次展开问题节点,都会发起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}

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文