以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- easyui目录树递归函数求助 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=122462) |
||||
-- 作者:liufucan -- 发布时间:2018/7/26 10:35:00 -- easyui目录树递归函数求助 我这段代码可以生成easyui四级目录树,请教老师怎么改成递归函数实现无限级目录树呢
|
||||
-- 作者:有点甜 -- 发布时间:2018/7/26 11:03:00 -- 1、帮助文档发出来;
2、具体实例发出来;
3、你递归的逻辑是什么请具体说明。 |
||||
-- 作者:blackzhu -- 发布时间:2018/7/26 11:14:00 -- 开和关 设置好 |
||||
-- 作者:liufucan -- 发布时间: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 |