以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]请教一个目录树定位的问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=50251)

--  作者:花开的声音
--  发布时间:2014/5/3 10:18:00
--  [求助]请教一个目录树定位的问题
通过表A生成目录树tv1,点选目录树的一个节点nd1,筛选出一条记录后,在窗口B的副本表中对该条记录进行编辑,然后将编辑后的数据保存到该条记录上。在保存数据,并对目录树进行刷新后,如何自动重新定位到节点A,并自动展开该节点。
--  作者:lsy
--  发布时间:2014/5/3 10:54:00
--  

“法律服务人员维护”窗口,“保存”按钮:

Dim t As Table = e.Form.Controls("基层法律服务人员信息表").Table
t.Filter = "_Identify = " & t.Current("_Identify")
For Each c As Col In t.Cols
    For Each ctl As WinForm.Control In e.Form.Controls
        If ctl.Name.Contains(c.Name) Then
            If c.IsBoolean Then
                t.Current(c.Name) = e.Form.Controls(ctl.Name).Checked
            Else
                t.Current(c.Name) = e.Form.Controls(ctl.Name).Value
            End If
        End If
    Next
Next
e.Form.Controls("基层法律服务人员信息表").Table.DataTable.Save
If Forms("导航窗口").Opened Then
    Dim tv As WinForm.TreeView = Forms("导航窗口").Controls("TreeView3")
    Forms("导航窗口").Controls("目录树刷新").PerformClick
    Dim name As String = e.Form.Controls("基层法律服务人员信息表").Table.Current("姓名")
    For Each nd As WinForm.TreeNode In tv.AllNodes
        If nd.Name = name Then
            tv.SelectedNode = nd
            nd.EnsureVisible
        End If
    Next
End If


--  作者:lsy
--  发布时间:2014/5/3 13:22:00
--  

姓名可能有重复的,改用身份证:

Dim t As Table = e.Form.Controls("基层法律服务人员信息表").Table
t.Filter = "_Identify = " & t.Current("_Identify")
For Each c As Col In t.Cols
    For Each ctl As WinForm.Control In e.Form.Controls
        If ctl.Name.Contains(c.Name) Then
            If c.IsBoolean Then
                t.Current(c.Name) = e.Form.Controls(ctl.Name).Checked
            Else
                t.Current(c.Name) = e.Form.Controls(ctl.Name).Value
            End If
        End If
    Next
Next
e.Form.Controls("基层法律服务人员信息表").Table.DataTable.Save
If Forms("导航窗口").Opened Then
    Dim tv As WinForm.TreeView = Forms("导航窗口").Controls("TreeView3")
    Forms("导航窗口").Controls("目录树刷新").PerformClick
    Dim identifier As String = e.Form.Controls("基层法律服务人员信息表").Table.Current("身份证号码")
    For Each nd As WinForm.TreeNode In tv.AllNodes
        If nd.DataRow("身份证号码") = identifier Then
            tv.SelectedNode = nd
            nd.EnsureVisible
        End If
    Next
End If