Foxtable(狐表)用户栏目专家坐堂 → 单击某一列,名头一样的合并,同时显示在最前面


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

主题:单击某一列,名头一样的合并,同时显示在最前面

帅哥,在线噢!
狐狸爸爸
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2013/3/18 16:39:00 [显示全部帖子]

你搞得太复杂了,postionChanged事件代码改为:

 

e.Table.StopRedraw
Dim lst1 As New List (of String)
Dim lst2 As New List (of String)
Dim r As Row = e.Table.Current
Dim idx As Integer = e.Table.colsel
For Each c As col In e.Table.cols
    Select Case c.name
        Case "日期","计划号","材质","粒度备注"
        Case Else
            If r.IsNull(c.name) Then
                lst2.add(c.name)
            Else
                lst1.add(c.name)
            End If
    End Select
Next
lst1.sort
lst2.sort
Dim p As Integer = 4
For i As Integer = 0 To lst1.count -1
    e.Table.Cols(lst1(i)).Move(p)
    p = p + 1
Next
For i As Integer = 0 To lst2.count -1
    e.Table.Cols(lst2(i)).Move(p)
    p = p + 1
Next
e.Table.Select(e.Table.Rowsel,idx)
e.Table.ResumeRedraw


 回到顶部
帅哥,在线噢!
狐狸爸爸
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2013/5/4 11:56:00 [显示全部帖子]

For i As Integer = 0 To lst2.count -1
    e.Table.Cols(lst2(i)).Move(p)
    p = p + 1
Next


 

改为:

 

For i As Integer = 0 To lst2.count -1
    e.Table.Cols(lst2(i)).Visisble = False
Next

[此贴子已经被作者于2013-5-4 11:56:08编辑过]

 回到顶部
帅哥,在线噢!
狐狸爸爸
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2013/5/4 12:45:00 [显示全部帖子]

e.Table.Cols(lst2(i)).Visible = False

 回到顶部
帅哥,在线噢!
狐狸爸爸
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2013/5/4 17:26:00 [显示全部帖子]

你在"泥料配比_1"的CurrentChanged事件设置同样的代码。

但是需要判断一下是否存在当前行:

 

 

e.Table.StopRedraw
Dim lst1 As New List (of String)
Dim lst2 As New List (of String)
Dim r As Row = e.Table.Current

if r Is nothing Then

   Return

End if
Dim idx As Integer = e.Table.colsel
For Each c As col In e.Table.cols
    Select Case c.name
        Case "日期","计划号","材质","粒度备注"
        Case Else
            If r.IsNull(c.name) Then
                lst2.add(c.name)
            Else
                lst1.add(c.name)
            End If
    End Select
Next
lst1.sort
lst2.sort
Dim p As Integer = 4
For i As Integer = 0 To lst1.count -1
    e.Table.Cols(lst1(i)).Move(p)
    p = p + 1
Next
For i As Integer = 0 To lst2.count -1
    e.Table.Cols(lst2(i)).Move(p)
    p = p + 1
Next
e.Table.Select(e.Table.Rowsel,idx)
e.Table.ResumeRedraw


 回到顶部
帅哥,在线噢!
狐狸爸爸
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2013/5/6 11:16:00 [显示全部帖子]

Dim lst1 As New List (of String)
Dim lst2 As New List (of String)
Dim r As Row = e.Table.Current
If r Is Nothing Then
   Return
End If
e.Table.StopRedraw
Dim idx As Integer = e.Table.colsel
For Each c As Col In e.Table.cols
    Select Case c.name
        Case "日期","计划号","材质","粒度备注"
        Case Else
            If r.IsNull(c.name) Then
                lst2.add(c.name)
            Else
                lst1.add(c.name)
            End If
    End Select
Next
lst1.sort
lst2.sort
Dim p As Integer = 4
For i As Integer = 0 To lst1.count -1
    e.Table.Cols(lst1(i)).Move(p)
    p = p + 1
Next
For i As Integer = 0 To lst2.count -1
    e.Table.Cols(lst2(i)).Move(p)
    p = p + 1
Next
e.Table.Select(e.Table.Rowsel,idx)
e.Table.ResumeRedraw

 回到顶部