Foxtable(狐表)用户栏目专家坐堂 → easyui目录树递归函数求助


  共有2355人关注过本帖树形打印复制链接

主题:easyui目录树递归函数求助

帅哥哟,离线,有人找我吗?
liufucan
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:三尾狐 帖子:649 积分:5730 威望:0 精华:0 注册:2017/4/7 12:15:00
easyui目录树递归函数求助  发帖心情 Post By:2018/7/26 10:35:00 [显示全部帖子]

我这段代码可以生成easyui四级目录树,请教老师怎么改成递归函数实现无限级目录树呢
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:目录树.txt



 回到顶部
帅哥哟,离线,有人找我吗?
liufucan
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:三尾狐 帖子:649 积分:5730 威望:0 精华:0 注册:2017/4/7 12:15:00
  发帖心情 Post By:2018/7/26 15:49:00 [显示全部帖子]

好好理解了一下递归,发现其实很容易,看来还是要自力更生啊。递归函数AddChildren如下:
Dim e As RequestEventArgs = args(0)
Dim nd As string = args(1)
Dim dt As DataTable = args(2)
dim ps2 as list(of string) = args(3)
dim ja as jarray = args(4)
dim i as integer = args(5)
dim ja2 as new jarray
ja(i)("children") = ja2 '


Dim drs2 As List(of DataRow) = dt.SQLSelect("mparent = '" & nd & "'")


dim j as integer  = 0
dim counti as integer = 0
For Each dr2 As DataRow In drs2
Dim nd2 As string = dr2("_Identify")
ja2.add(new jobject)
ja2(j)("id") = dr2("_Identify").tostring
ja2(j)("text") = dr2("mname").tostring
if ps2.Contains(dr2("_Identify"))  then
ja2(j)("checked") = "true"
counti = counti + 1

end if


Functions.Execute("AddChildren",e,nd2,dt,ps2,ja2,j)

j = j +1
next


if counti <> drs2.count
ja(i)("checked") = ""
end if


 回到顶部