以文本方式查看主题
- Foxtable(狐表) (http://foxtable.com/bbs/index.asp)
-- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2)
---- 从aftercheckNode换到点击node (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=124252)
|
-- 作者:susu312
-- 发布时间:2018/9/3 11:33:00
-- 从aftercheckNode换到点击node
此主题相关图片如下:1.png
afterchecknode代码:
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 = "" If nd.Checked Then If val > "" Then val = val & " or " End If val = val & " organName = \'" & nd.text & "\'" End If
If flt > "" Then flt = flt & " Or (" & val & ")" Else flt = val End If End If Next
老师,现在有个需求,就是点击节点,就能勾选是哪个那个check框,请您给我指导下
|
-- 作者:有点甜
-- 发布时间:2018/9/3 11:41:00
--
notemouseclick事件加入代码
e.node.checked = not e.node.checked
|
-- 作者:susu312
-- 发布时间:2018/9/3 15:11:00
--
以下是引用有点甜在2018/9/3 11:41:00的发言:
notemouseclick事件加入代码
e.node.checked = not e.node.checked
1、老师,这么做可以勾选上,但是希望勾选上后,同时具备afterchecknode的功能?就是可以筛选出来,请老师指导一下
2、老师,如何让点击目录树那个加号, 也能重新生成一下目录树,就是更新一下?展开和折叠按钮都有这个功能,那个加号么有
展开的代码:
DataTables("organList").LoadFilter = "organName = \'" & _UserOrgan & "\' or superName = \'" & _UserOrgan & "\'" DataTables("organList").LoadTop = Nothing DataTables("organList").load
Dim tr As WinForm.TreeView tr = Forms("单位管理").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() \'\'恢复绘制目录树 tr.ExpandAll
我觉得代码应该类似的, 但是不知倒应该加在哪里?在before expand node 和 after expandnode里面都加了,但是没有用,应该
[此贴子已经被作者于2018/9/3 15:20:54编辑过]
|
-- 作者:有点甜
-- 发布时间:2018/9/3 15:24:00
--
notemouseclick事件,写代码实现筛选,类似
e.node.checked = not e.node.checked
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 = "" If nd.Checked Then If val > "" Then val = val & " or " End If val = val & " organName = \'" & nd.text & "\'" End If
If flt > "" Then flt = flt & " Or (" & val & ")" Else flt = val End If End If Next
|
-- 作者:有点甜
-- 发布时间:2018/9/3 15:26:00
--
以下是引用susu312在2018/9/3 15:11:00的发言:
2、老师,如何让点击目录树那个加号, 也能重新生成一下目录树,就是更新一下?展开和折叠按钮都有这个功能,那个加号么有
编写 BeforeExpandNode 事件代码,不会做上传实例。
|
-- 作者:susu312
-- 发布时间:2018/9/3 15:42:00
--
以下是引用有点甜在2018/9/3 15:24:00的发言:
notemouseclick事件,写代码实现筛选,类似
e.node.checked = not e.node.checked
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 = "" If nd.Checked Then If val > "" Then val = val & " or " End If val = val & " organName = \'" & nd.text & "\'" End If
If flt > "" Then flt = flt & " Or (" & val & ")" Else flt = val End If End If Next
Dim trv As WinForm.TreeView = e.Sender Dim flt As String Dim nd As WinForm.TreeNode For Each nd In e.node.allNodes \'清除子节点的选中标记 nd.IsSelected=False Next nd = e.Node.ParentNode Do While nd IsNot Nothing \'清除父节点的选中标记 nd.IsSelected=False nd = nd.ParentNode Loop For Each nd In trv.AllNodes If nd.IsSelected Then Dim rts() As String = nd.FullPath.Split("\\") Dim val As String = "" If nd.IsSelected Then If val > "" Then val = val & " or " End If val = val & " organName = \'" & nd.text & "\'" End If
If flt > "" Then flt = flt & " Or (" & val & ")" Else flt = val End If End If Next
老师,这里我把checked改为 is seclected ,但是,说is seclected是只读的
|
-- 作者:有点甜
-- 发布时间:2018/9/3 15:49:00
--
不然你就改成
e.node.checked = not e.node.checked
Dim trv As WinForm.TreeView = e.Sender Dim flt As String Dim nd As WinForm.TreeNode For Each nd In trv.AllNodes If nd.Checked Then Dim rts() As String = nd.FullPath.Split("\\") Dim val As String = "" If nd.Checked Then If val > "" Then val = val & " or " End If val = val & " organName = \'" & nd.text & "\'" End If
If flt > "" Then flt = flt & " Or (" & val & ")" Else flt = val End If End If Next
|
-- 作者:susu312
-- 发布时间:2018/9/3 15:57:00
--
以下是引用有点甜在2018/9/3 15:49:00的发言:
不然你就改成
e.node.checked = not e.node.checked
Dim trv As WinForm.TreeView = e.Sender Dim flt As String Dim nd As WinForm.TreeNode For Each nd In trv.AllNodes If nd.Checked Then Dim rts() As String = nd.FullPath.Split("\\") Dim val As String = "" If nd.Checked Then If val > "" Then val = val & " or " End If val = val & " organName = \'" & nd.text & "\'" End If
If flt > "" Then flt = flt & " Or (" & val & ")" Else flt = val End If End If Next
老师,这么写,只能让复选框勾上,但是不能实现aftercheckdednode的筛选功能
|
-- 作者:有点甜
-- 发布时间:2018/9/3 15:58:00
--
以下是引用susu312在2018/9/3 15:57:00的发言:
老师,这么写,只能让复选框勾上,但是不能实现aftercheckdednode的筛选功能
你最后要写筛选啊
Tables("某表").filter = flt
|
-- 作者:susu312
-- 发布时间:2018/9/3 16:06:00
--
以下是引用有点甜在2018/9/3 15:58:00的发言:
你最后要写筛选啊
Tables("某表").filter = flt
啊,我好糊涂呀
|