我有一个窗口,设置了目录树,但有问题!树中是有筛选条件的,双击树中的单项时是筛选的结果,但最上面的“显示所有行”却没有筛选结果,不知道为什么?求大神指点,如下图:
窗口afterload中的代码为:
'筛选树开始
Dim dt As DataTable
Dim b As New GroupTableBuilder("签单档案管理_table1",DataTables("峰和设计部"))
b.Groups.AddDef("事件日期",DateGroupEnum.Year,"年")
b.Groups.AddDef("事件日期",DateGroupEnum.Month,"月")
b.Groups.AddDef("设计师")
b.Totals.AddDef("客户姓名",AggregateEnum.Count,"订单数") '根据客户列来统计记录数,也就是订单数
b.Filter = "Not (操作性 = '跑单' or 操作性 = '可操作' or 操作性 = '等待中' or 操作性 = '预收设计' or 操作性 = '预签' or 操作性 = '放一下' or 操作性 = '问题单' or 操作性 = '未知')"
dt = b.Build(False) '参数设置为False,生成一个临时表,不在主界面显示
'然后根据统计表生成目录树
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
trv.BuildTree(dt, "年|月|设计师")
trv.StopRedraw
For Each nd As WinForm.TreeNode In trv.AllNodes
Dim Year As Integer = nd.DataRow("年")
Dim Month As Integer = nd.DataRow("月")
Dim Product As String = nd.DataRow("设计师")
Select Case nd.Level
Case 0
nd.Text = nd.text & "年(" & dt.Compute("Sum(订单数)","年 = " & Year) & "条)"
Case 1
nd.Text = nd.text & "月(" & dt.Compute("Sum(订单数)","年 = " & Year & " And 月 = " & Month) & "条)"
Case 2
nd.Text = nd.text & "(" & nd.DataRow("订单数") & "条)"
End Select
Next
trv.Nodes.Insert("显示所有行","显示所有行(" & dt.Compute("Sum(订单数)") & "条)",0)
trv.ResumeRedraw
'筛选树结束
Dim zz As New GroupTableBuilder("temp",DataTables("峰和设计部"))
目录树的afterchecknode中的代码为:
Dim trv As WinForm.TreeView = e.Sender
Dim flt As String = "1=2"
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
If nd.Name <> "显示所有行" Then '要用Name属性,不能用Text属性
Dim d1 As Date
Dim d2 As Date
Dim Year As Integer = nd.DataRow("年")
Dim Month As Integer = nd.DataRow("月")
Dim Product As String = nd.DataRow("设计师")
Dim filter As String = "1=2"
Select Case e.Node.Level
Case 0
d1 = New Date(Year,1,1) '取得该年的第一天
d2 = new Date(Year,12,31) '取得该年的最后一天
Filter = "事件日期 >= #" & d1 & "# And 事件日期 <= #" & d2 & "#"
Case 1
d1 = New Date(Year, Month, 1) '取得该月的第一天
d2 = new Date(Year, Month, Date.DaysInMonth(Year,Month)) '取得该月的最后一天
Filter = "事件日期 >= #" & d1 & "# And 事件日期 <= #" & d2 & "#"
Case 2
d1 = New Date(Year, Month, 1) '取得该月的第一天
d2 = new Date(Year, Month, Date.DaysInMonth(Year,Month)) '取得该月的最后一天
Filter = "事件日期 >= #" & d1 & "# And 事件日期 <= #" & d2 & "# And 设计师 = '" & Product & "'"
End Select
flt &= " or (" & filter & ")"
Else
flt = ""
Exit For
End If
End If
Next
目录树的nodemousedoubleclick中的代码为:
Dim Filter As String = ""
If e.node.Name <> "显示所有行" Then '要用Name属性,不能用Text属性
Dim d1 As Date
Dim d2 As Date
Dim Year As Integer = e.Node.DataRow("年")
Dim Month As Integer = e.Node.DataRow("月")
Dim Product As String = e.Node.DataRow("设计师")
Select Case e.Node.Level
Case 0
d1 = New Date(Year,1,1) '取得该年的第一天
d2 = new Date(Year,12,31) '取得该年的最后一天
Filter = "事件日期 >= #" & d1 & "# And 事件日期 <= #" & d2 & "#"
Case 1
d1 = New Date(Year, Month, 1) '取得该月的第一天
d2 = new Date(Year, Month, Date.DaysInMonth(Year,Month)) '取得该月的最后一天
Filter = "事件日期 >= #" & d1 & "# And 事件日期 <= #" & d2 & "#"
Case 2
d1 = New Date(Year, Month, 1) '取得该月的第一天
d2 = new Date(Year, Month, Date.DaysInMonth(Year,Month)) '取得该月的最后一天
Filter = "事件日期 >= #" & d1 & "# And 事件日期 <= #" & d2 & "# And 设计师 = '" & Product & "'"
End Select
End If
Tables("签单档案管理_Table1").Filter = iif(filter>"", "(" & filter & ") And Not (操作性 = '跑单' or 操作性 = '可操作' or 操作性 = '等待中' or 操作性 = '预收设计' or 操作性 = '预签')", "Not (操作性 = '放一下' or 操作性 = '问题单' or 操作性 = '未知')")
此主题相关图片如下:qq截图20160302110706.jpg
求老师指点,问题出在那里?跪求!!!
此主题相关图片如下:qq截图20160302110648.jpg