在项目里用ztree时遇到一个问题,只有最后一个根节点的子节点显示,其他的子节点都加载不出来!
@zTree 你好,在项目里用ztree时遇到一个问题,只有最后一个根节点的子节点显示,其他的子节点都加载不出来!想跟你请教个问题:jquery.min-2.1.4.js这是项目里的jquery版本!这个要怎么解决啊?
这是引入的js
这是代码
异步加载这样,在zTreeNodes=[]里写死节点数据也是这种效果!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
你现在再把这个设置去掉,立刻就出现问题么?? 有点儿不可思议呀
是啊 这就是蛋疼的地方,把我的数据放在官方的demo里没问题,把官方demo的数据放在我的项目里有问题,这就肯定不是节点数据的问题了,可能是配置问题或js文件冲突之类的!但是这种问题不好找啊!头都要炸了
引用来自“jvquery”的评论
zList=[{"id":1,"name":"****","pid":0,"open":"true","checked":"true"}
,{"id":101,"name":"****","pid":1,"checked":"true"}
,{"id":102,"name":"****","pid":1,"checked":"true"}
,{"id":103,"name":"****","pid":1,"checked":"true"}
,{"id":104,"name":"****","pid":1,"checked":"true"}
,{"id":105,"name":"****","pid":1,"checked":"true"}
,{"id":106,"name":"****","pid":1,"checked":"true"}
,{"id":2,"name":"****","pid":0,"open":"true","checked":"true"}
,{"id":201,"name":"****","pid":2,"checked":"true"}
,{"id":202,"name":"****","pid":2,"checked":"true"}
,{"id":3,"name":"****","pid":0,"open":"true","checked":"true"}
,{"id":301,"name":"****","pid":3,"checked":"true"}
,{"id":4,"name":"****","pid":0,"open":"true","checked":"true"}
,{"id":401,"name":"****","pid":4,"checked":"true"}
,{"id":402,"name":"****","pid":4,"checked":"true"}
,{"id":403,"name":"****","pid":4,"checked":"true"}
,{"id":5,"name":"****","pid":0,"open":"true","checked":"true"}
,{"id":501,"name":"****","pid":5,"checked":"true"}
,{"id":502,"name":"****","pid":5,"checked":"true"}
,{"id":6,"name":"****","pid":0,"open":"true"}
,{"id":601,"name":"****","pid":6}
,{"id":602,"name":"****","pid":6}
,{"id":7,"name":"****","pid":0,"open":"true"}
,{"id":701,"name":"****","pid":7}
,{"id":702,"name":"****","pid":7}
,{"id":703,"name":"****","pid":7}
,{"id":704,"name":"****","pid":7}
,{"id":705,"name":"****","pid":7}
,{"id":8,"name":"****","pid":0,"open":"true"}
,{"id":801,"name":"****","pid":8}
,{"id":802,"name":"****","pid":8}
,{"id":803,"name":"****","pid":8}
,{"id":9,"name":"****","pid":0,"open":"true"}
,{"id":901,"name":"****","pid":9}
,{"id":902,"name":"****","pid":9}
,{"id":903,"name":"****","pid":9}
,{"id":10,"name":"****","pid":0,"open":"true"}
,{"id":1001,"name":"****","pid":10}
,{"id":1002,"name":"****","pid":10}
,{"id":11,"name":"****","pid":0,"open":"true"}
,{"id":1101,"name":"****","pid":11}
,{"id":1102,"name":"****","pid":11}]
这是后台响应的节点数据
zList=[{"id":1,"name":"****","pid":0,"open":"true","checked":"true"}
,{"id":101,"name":"****","pid":1,"checked":"true"}
,{"id":102,"name":"****","pid":1,"checked":"true"}
,{"id":103,"name":"****","pid":1,"checked":"true"}
,{"id":104,"name":"****","pid":1,"checked":"true"}
,{"id":105,"name":"****","pid":1,"checked":"true"}
,{"id":106,"name":"****","pid":1,"checked":"true"}
,{"id":2,"name":"****","pid":0,"open":"true","checked":"true"}
,{"id":201,"name":"****","pid":2,"checked":"true"}
,{"id":202,"name":"****","pid":2,"checked":"true"}
,{"id":3,"name":"****","pid":0,"open":"true","checked":"true"}
,{"id":301,"name":"****","pid":3,"checked":"true"}
,{"id":4,"name":"****","pid":0,"open":"true","checked":"true"}
,{"id":401,"name":"****","pid":4,"checked":"true"}
,{"id":402,"name":"****","pid":4,"checked":"true"}
,{"id":403,"name":"****","pid":4,"checked":"true"}
,{"id":5,"name":"****","pid":0,"open":"true","checked":"true"}
,{"id":501,"name":"****","pid":5,"checked":"true"}
,{"id":502,"name":"****","pid":5,"checked":"true"}
,{"id":6,"name":"****","pid":0,"open":"true"}
,{"id":601,"name":"****","pid":6}
,{"id":602,"name":"****","pid":6}
,{"id":7,"name":"****","pid":0,"open":"true"}
,{"id":701,"name":"****","pid":7}
,{"id":702,"name":"****","pid":7}
,{"id":703,"name":"****","pid":7}
,{"id":704,"name":"****","pid":7}
,{"id":705,"name":"****","pid":7}
,{"id":8,"name":"****","pid":0,"open":"true"}
,{"id":801,"name":"****","pid":8}
,{"id":802,"name":"****","pid":8}
,{"id":803,"name":"****","pid":8}
,{"id":9,"name":"****","pid":0,"open":"true"}
,{"id":901,"name":"****","pid":9}
,{"id":902,"name":"****","pid":9}
,{"id":903,"name":"****","pid":9}
,{"id":10,"name":"****","pid":0,"open":"true"}
,{"id":1001,"name":"****","pid":10}
,{"id":1002,"name":"****","pid":10}
,{"id":11,"name":"****","pid":0,"open":"true"}
,{"id":1101,"name":"****","pid":11}
,{"id":1102,"name":"****","pid":11}]
这是后台响应的节点数据
你先给ID PID等属性加上双引号“ID“,还是不行你试一下run官方给的网页demo,还不行你换一个浏览器run
复制的官方的demo节点数据,效果一样的!
写死的代码贴出来了! 节点数据应该是没问题的,树加载出来之后我获取所以checked的节点id,都能获取到,而且层级关系也没错,就是显示不出来!
静态数据? 你是说节点的数据吗?如果是……后台响应的节点数据肯定是没错的