以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]如何在通用多选目录树加载代码上增加加载条件  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=64675)

--  作者:无限5180
--  发布时间:2015/2/26 22:13:00
--  [求助]如何在通用多选目录树加载代码上增加加载条件

下面是论坛里通用多选目录树代码,我想继续添加加载条件,如都只加载[员工代码]=’YG’,并且[员工编号]不为空的行,应该如何设置,请大虾指点一下,不胜感激!!!

Dim Lbs As String() ={"产品","客户","雇员","折扣","日期"}  \'通用多选目录树加载代码.套用时只需修改本行.

Dim trv As WinForm.TreeView = e.Sender

Dim nd As WinForm.TreeNode = trv.SelectedNode

Dim flt,s1 As String

Dim n1 As Integer

 

For Each ndx As WinForm.TreeNode In nd.allNodes \'同步子节点选中状态

    ndx.Checked = nd.Checked

Next

If nd.ParentNode IsNot Nothing Then     \'确定父节点选中状态:

    For i As Integer = nd.ParentNode.level To 0 Step -1   \'

        Dim Inum As Integer = nd.ParentNode.Nodes.Count

        For Each ndc As WinForm.TreeNode In nd.ParentNode.Nodes

            If ndc.Checked Then

                Inum = Inum -1

            End If

        Next

        If Inum = 0 Then

            nd.ParentNode.Checked = True

            nd = nd.ParentNode

        Else

            nd.ParentNode.Checked = False

            nd = nd.ParentNode

        End If

    Next

End If

For Each nd In trv.AllNodes

    If nd.Level > 0 AndAlso nd.ParentNode.Checked Then \'如果父节点选中

        Continue For \'跳过此节点,处理下一结点

    End If

    If nd.Checked AndAlso nd.FullPath IsNot Nothing Then

        n1=0

        For Each s1 In nd.FullPath.split("\\")

            flt+ =iif(n1 =0,") Or (" ," and ")  & Lbs(n1) & " = \'" & s1 & "\'"

            n1+=1

        Next

    End If

Next

Application.DoEvents  \'先勾选目录树,再加载数据.

If  flt  IsNot Nothing  Then

    Tables("订单").DataTable.LoadFilter = flt.Substring(4) & ")"

    Tables("订单").DataTable.Load()

Else

    Tables("订单").DataTable.LoadFilter ="[_Identify] Is Null"

    Tables("订单").DataTable.Load()

End If


--  作者:有点甜
--  发布时间:2015/2/26 23:09:00
--  

 

If  flt  IsNot Nothing  Then

    Tables("订单").DataTable.LoadFilter = "(" & flt.Substring(4) & ")) and 员工代码]=\'YG\' and 员工编号 is not null"

    Tables("订单").DataTable.Load()

Else

    Tables("订单").DataTable.LoadFilter ="员工代码]=\'YG\' and 员工编号 is not null"

    Tables("订单").DataTable.Load()

End If


--  作者:无限5180
--  发布时间:2015/2/27 0:04:00
--  
非常感谢!