以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 多级筛选,不分层级代码修改 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=126720) |
-- 作者:weibu -- 发布时间:2018/10/27 10:28:00 -- 多级筛选,不分层级代码修改 问题描述举例:我目录树AfterCheckNode事件;点击层级为:001.003进行筛选;筛选结果确包含了001.001.003;001.003.001;001.003的数据。我希望只筛选001.003.001和00.1.003而不能筛选出001.001.003; 代码如下,需如何优化: 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 val = "层级 Like \'%" & nd.FullName.replace("\\", ".") & "%\'" If flt > "" Then flt = flt & " Or (" & val & ")" Else flt = val End If End If Next Tables("用户信息").Filter = flt |
-- 作者:有点蓝 -- 发布时间:2018/10/27 10:30:00 -- Dim val = "层级 Like \'" & nd.FullName.replace("\\", ".") & "%\'" |