设计一个目录树,但是第二级的“按月份”,照葫芦画瓢就是搞不出来,afterload部分自己也搞过,不行。请老师指点一下,谢谢!
Dim t As Table = Tables("员工考勤库")
If e.Node.Level = 2 Then
Dim ary() As String = e.node.FullName.Split("\")
If ary(1) = "按员工" Then
t.filter = "员工='" & ary(2) & "'"
ElseIf ary(1) = "按年份" Then
t.filter = "年=" & ary(2)
ElseIf ary(1) = "按组别" Then
t.filter = "组别=" & ary(2)
End If
End If
If e.Node.Level = 3 Then
Dim ary() As String = e.node.FullName.Split("\")
If ary(1) = "按年份" And ary(2) = "按月份" Then
t.filter = "年=" & ary(2) & " and 月=" & ary(3) & ""
End If
End If
afterload:
Dim trv As WinForm.TreeView = e.Form.controls("treeview1")
Dim dt As DataTable = DataTables("员工考勤库")
Dim kq_yg As WinForm.TreeNode = trv.Nodes("考勤记录").Nodes("按员工")
kq_yg.nodes.Clear
For Each yg As String In dt.GetValues("员工")
kq_yg.Nodes.Add(yg)
Next
Dim kq_yy As WinForm.TreeNode = trv.Nodes("考勤记录").Nodes("按年份")
kq_yy.nodes.Clear
For Each ym As String In dt.GetValues("年")
kq_yy.Nodes.Add(ym)
Next
Dim kq_gp As WinForm.TreeNode = trv.Nodes("考勤记录").Nodes("按组别")
kq_gp.nodes.Clear
For Each gp As String In dt.GetValues("组别")
kq_gp.Nodes.Add(gp)
Next