最近加了一个左侧导航菜单,所以想缩减筛选树占用的宽度,将原本一个筛选树分拆放进两个TreeView控件里
于是产生两个疑问
1. 如何让这两个筛选树联动?目前是两个控件互相独立筛选的
2.能否做进一个TreeView里?
先谢谢啦:D
窗口afterload里
e.Form.Controls("TreeView1").BuildTree(vars("table1"), "状态|考核体")
e.Form.Controls("TreeView2").BuildTree(vars("table1"), "部门大类|部门小类|岗位大类")
TreeView1里
Dim nms As String() = {"状态","考核体"} '指定生成目录树的各列
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("cmst_sh_hr_hmc").Filter = flt
TreeView2里
Dim nms As String() = {"部门大类","部门小类","岗位大类"} '指定生成目录树的各列
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("cmst_sh_hr_hmc").Filter = flt