一篇详细的总结https://blog.csdn.net/judyfun/article/details/
在http://www.destroydrop.com/javascripts/tree/下载dtree源码
具体参数看上面博客
如果说要做成可以搜索的tree,我搜索到ztree可以实现,而dtree很少实现这功能,大家可以百度一哈
接下来是最近笔试遇到的类似问题,从数据库读取之后显示到dtree上,今天总结一哈

数据库如上图
tid为这一节点的id,pid为父级id,id为真实的节点id
参照:
d.add(0,-1,'My example tree');
d.add(1,0,'Node 1','example01.html');
d.add(2,0,'Node 2','example01.html');
d.add(3,1,'Node 1.1','example01.html');
d.add(4,0,'Node 3','example01.html');
d.add(5,3,'Node 1.1.1','example01.html');
d.add(6,5,'Node 1.1.1.1','example01.html');
d.add(7,0,'Node 4','example01.html');
d.add(8,1,'Node 1.2','example01.html');
d.add(9,0,'My Pictures','example01.html','Pictures I\'ve taken over the years','','','img/imgfolder.gif');
d.add(10,9,'The trip to Iceland','example01.html','Pictures of Gullfoss and Geysir');
d.add(11,9,'Mom\'s birthday','example01.html');
d.add(12,0,'Recycle Bin','example01.html','','','img/trash.gif');
所以只需要此时的id还有父级id即可
sql语句

搜索结果

已经查询出自己节点id以及父级节点的id
接下来你们自己完成咯
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/222453.html原文链接:https://javaforall.net
