此主题相关图片如下:无标题.png
请教老师,我在表格中通过下拉目录树输入内容,但是和普通的内容输入有区别,我想要的结果:
如上图,
如果我点击“变频器”,则要求“分配A”的值=“驱动组”,“分配B”的值=“变频器”;
如果我点击“驱动组”,则要求“分配A”的值=“技术部”,“分配B”的值=“驱动组”
当然,后面可能会根据组织机构的变化,目录树层数也会发生变化,希望的结果就是,只提取选中节点及其父节点的名称分别填入“分配B”和“分配A”
目前的表格CLICK代码如下:
If e.Col.name = "分配A"
Dim cl As String
Dim db As DataTable = DataTables("组织机构")
Dim dr As DataRow
Dim q As Integer
For i As Integer = 0 To 6
dr = db.find("权限" & i & " = '技术部'","权限")
If dr IsNot Nothing
q = dr("权限") - 1
Exit For
End If
Next
For i As Integer = q To 6
If i < 6
cl += "权限" & i & "|"
Else
cl += "权限" & i
End If
Next
Dim tbq As new droptreebuilder
tbq.sourcetable = DataTables("组织机构")
tbq.treefilter = "权限" & q & " = '技术部' or 权限" & q & " = '工程部'"
tbq.treecols = cl
'tbq.treecols = "权限" & q & "|权限" & q + 1
'tbq.sourcecols = "权限" & q & "|权限" & q + 1
'tbq.sourcecols = cl
tbq.receivecols = "分配A|分配B"
Tables(e.Form.name & "_table1").Cols("分配A").droptree = tbq.build()
End If
上面的代码实现不了我的要求,请问,要实现我的要求,应该如何修改代码?
恳请老师答疑