Foxtable(狐表)用户栏目专家坐堂 → 目录树复选框问题


  共有1966人关注过本帖树形打印复制链接

主题:目录树复选框问题

帅哥哟,离线,有人找我吗?
douglas738888
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:五尾狐 帖子:1175 积分:8792 威望:0 精华:0 注册:2012/4/18 16:28:00
目录树复选框问题  发帖心情 Post By:2018/6/22 11:34:00 [只看该作者]

请教老师,下面代码能实现选择1个或多个复选框后,节点的String会填入到表A的列“范围”中,取消勾选,清除String

 

问题:现在想实现,勾选复选框后,把节点Level0 和Level1的字符填入到指定列中,应该怎样调整代码

 

例如:

目录树由表B的一级分类和二级分类生成目录树

目录树                                                            表A

+ A类                                                            范围                                                                    

        √A1                                                      A类:A1

        √A2                                                      A类:A2

+ B类                                                            B类:B2

          B1

        √B2

 

Dim trv As WinForm.TreeView = e.Sender
Dim flt As String
Dim r As Row = Tables("表A").Current
For Each nd As WinForm.TreeNode In e.node.Nodes 
    nd.Checked = False
Next
If e.node.ParentNode IsNot Nothing Then 
    e.node.ParentNode.Checked = False
End If
For Each nd As WinForm.TreeNode In trv.AllNodes
      If nd.Checked Then
        If flt > "" Then
            flt = flt & vbcrlf & vbcrlf 
        End If
        'If nd.Level = 0 Then 
            flt = flt & nd.Text
        'Else
            'flt = flt & "( 一级分类 = '" & nd.ParentNode.Text & "' And 二级分类 = '" & nd.Text & "')"
        'End If
    End If   
Next
r("范围") = flt


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/6/22 11:40:00 [只看该作者]

Dim trv As WinForm.TreeView = e.Sender
Dim flt As String
Dim r As Row = Tables("表A").Current
For Each nd As WinForm.TreeNode In e.node.Nodes
    nd.Checked = False
Next
If e.node.ParentNode IsNot Nothing Then
    e.node.ParentNode.Checked = False
End If
For Each nd As WinForm.TreeNode In trv.AllNodes
    If nd.Checked Then
        If nd.Level = 1 Then
            flt = flt & nd.ParentNode.text & ":" & nd.Text  & vbcrlf
        End If
    End If
Next
r("范围") = flt
[此贴子已经被作者于2018/6/22 11:40:41编辑过]

 回到顶部