-- 作者:susu312
-- 发布时间:2018/8/21 10:41:00
-- 目录树afterchecknode
\'\'目录树生成代码 Tables("organList").Filter = "" Dim tr As WinForm.TreeView = e.Form.Controls("TreeView1") Dim nd As WinForm.TreeNode Dim dt As DataTable = DataTables("organList") tr.StopRedraw()\'\'停止绘制目录树 tr.Nodes.Clear \'tr.Nodes.Add("全部") For Each dr As DataRow In dt.datarows If dr.IsNull("superName") Then \'If dr("organName") = _UserOrgan Then nd = tr.Nodes.Add(dr("organName"),dr("organName")) Functions.Execute("AddChildren",nd,dt) End If Next tr.ResumeRedraw() \'\'恢复绘制目录树
\'\'目录树checknode代码
Dim nms As String() = {"superName","organName"} \'指定生成目录树的各列 Dim qts As String() = {"\'","\'"} \'指定将各列的值括起来的符号,这里都是字符型,所以都是单引号 Dim trv As WinForm.TreeView = e.Sender Dim flt As String Dim nd As WinForm.TreeNode For Each nd In e.node.allNodes \'清除子节点的选中标记 nd.Checked = False Next nd = e.Node.ParentNode Do While nd IsNot Nothing \'清除父节点的选中标记 nd.Checked = False nd = nd.ParentNode Loop For Each nd In trv.AllNodes If nd.Checked Then Dim rts() As String = nd.FullPath.Split("\\") Dim val As String = "" For i As Integer = 0 To rts.length - 1 If val > "" Then val = val & " And " End If val = val & nms(i) & " = " & qts(i) & rts(i) & qts(i) Next If flt > "" Then flt = flt & " Or (" & val & ")" Else flt = val End If End If Next Tables("organList").Filter = flt
老师,您看这个目录树筛选只能是两级,如果我点县支行,它就报错了,我不会改afterchecknode代码,如何让它可以三级都筛选,也没有问题. 此主题相关图片如下:1.png
|