Foxtable(狐表)用户栏目专家坐堂 → 关于列设置


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

主题:关于列设置

帅哥哟,离线,有人找我吗?
裴保民
  31楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1989 积分:12631 威望:0 精华:0 注册:2017/4/3 15:01:00
  发帖心情 Post By:2019/3/24 19:21:00 [只看该作者]

甜老师,以开发者的身份进去,保存后是显示和隐藏的列怎么不符合呢?
选择的列和操作后的结果咧不符合
更改前:

图片点击可在新窗口打开查看此主题相关图片如下:999.png
图片点击可在新窗口打开查看
更改后:

图片点击可在新窗口打开查看此主题相关图片如下:910.png
图片点击可在新窗口打开查看




如果登录的身份是“abc”就正常,是怎么回事?
[此贴子已经被作者于2019/3/24 19:39:41编辑过]

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


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

我测试没问题,请照抄这段代码

 

Dim clist As WinForm.CheckedListBox = e.Form.Controls("lieCheckedListBox")
Dim szlxs As WinForm.RadioButton = e.Form.Controls("shezhiliekuanyushunxu")
Dim xsyycl As WinForm.RadioButton = e.Form.Controls("xianshiyuyincanglie")
If xsyycl.Checked Then
    For i As Integer = clist.Items.Count - 1 To 0 Step -1
        CurrentTable.Cols(clist.items(i)).Visible = not clist.GetItemChecked(i)
    Next
End If
Dim t As WinForm.Table = e.Form.Controls("Table1")
Dim fdr As DataRow = DataTables("列设置").Find("表名 = '" & t.Table.DataTable.Name & "'And  用户 ='" & User.Name &"'")
If fdr Is Nothing Then
    fdr = DataTables("列设置").AddNew
    fdr("表名") =t.Table.DataTable.Name
    fdr("用户") = User.Name
End If
fdr("列设置") = t.Table.GetColVisibleWidth
For Each dr As DataRow In DataTables("列设置").Select(" 用户 ='" & User.Name &"'")
    If Tables.Contains(dr("表名")) Then
        Tables(dr("表名")).SetColVisibleWidth(dr("列设置"))
    End If
Next


 回到顶部
帅哥哟,离线,有人找我吗?
裴保民
  33楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1989 积分:12631 威望:0 精华:0 注册:2017/4/3 15:01:00
  发帖心情 Post By:2019/3/25 18:52:00 [只看该作者]

For Each dr As DataRow In DataTables("列设置").Select(" 用户 ='" & User.Name &"'")  甜老师这句代码是不是得同时判断用户和表名呀?
    If Tables.Contains(dr("表名")) Then
        Tables(dr("表名")).SetColVisibleWidth(dr("列设置"))
    End If
Next



改为下面代码代码:

For Each dr As DataRow In DataTables("列设置").Select(" 表名 ='" & dr("表名") &"'And  用户 ='" & User.Name &"'") 
    If Tables.Contains(dr("表名")) Then
        Tables(dr("表名")).SetColVisibleWidth(dr("列设置"))
    End If
Next

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


加好友 发短信
等级:超级版主 帖子:106132 积分:539771 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/3/25 20:02:00 [只看该作者]

For Each dr As DataRow In DataTables("列设置").Select(" 表名 ='" & fdr("表名") & "' And  用户 ='" & User.Name & "'") 

 回到顶部
帅哥哟,离线,有人找我吗?
裴保民
  35楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1989 积分:12631 威望:0 精华:0 注册:2017/4/3 15:01:00
  发帖心情 Post By:2019/3/27 10:57:00 [只看该作者]

在“复选列表框”的ItemCheck事件写了如下代码 运行后发现,只要有隐藏列存在,在选择“复选列表框”的值的时候,选择的列就和数据表中的列不一致,看看哪错了

Dim tzsx As WinForm.RadioButton = e.Form.Controls("tiaozhengliedeshunxuRadioButton")
If tzsx.Checked Then
If e.Checked Then
    Dim cst As WinForm.CheckedListBox = e.sender
    For i As Integer = 0 To cst.Items.count - 1
        If i <> e.Index Then
            cst.SetItemChecked(i, False)
        End If
    Next
End If
End If
Dim t As Table = e.Form.controls("Table1").Table
If t.rows.count > 0 Then
t.Select(0,e.Index)
t.LeftVisibleCol = e.Index
End If


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


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

改一下

 

Dim t As Table = e.Form.controls("Table1").Table
Dim c As Col = t.cols(cst.Items(e.index))
t.Select(-1, c.Index)
t.LeftVisibleCol = c.Index

 回到顶部
帅哥哟,离线,有人找我吗?
裴保民
  37楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1989 积分:12631 威望:0 精华:0 注册:2017/4/3 15:01:00
  发帖心情 Post By:2019/4/14 10:46:00 [只看该作者]

在“列的显示与隐藏”单选框写了如下代码'运行后发现“lieCheckedListBox”控件中加载两边字段呢?


Dim ldsxyyc As WinForm.RadioButton = e.Form.Controls("ldxsyycRadioButton")
Dim liexz As WinForm.CheckedListBox = e.Form.Controls("lieCheckedListBox")
Dim t As WinForm.Table = e.Form.Controls("Table1")
Dim str As String = ""
If ldsxyyc.Checked=True Then
    e.Form.Controls("tzlsxGroupBox").Enabled=False
    e.Form.Controls("ycyxslGroupBox").Enabled=True
    e.Form.Controls("sjldczGroupBox").Enabled=True
    liexz.Value =""
    liexz.SelectedValue=""
End If
liexz.CheckOnClick=True
Dim dtshb As WinForm.Table = e.Form.Controls("Table1")
For Each c As Col In t.Table.Cols
    If t.Table.DataTable.Name ="客户资料" Then
        If _UserGroup ="系统管理员" OrElse _UserGroup = "数据管理员"   Then
            If c.name <>"身份证号掩码显示" AndAlso c.name <> "客户主手机号掩码显示" AndAlso c.name <> "第二手机号掩码显示"  AndAlso  c.name <> "第三手机号掩码显示" Then
                str &= c.name & "|"
            End If
        ElseIf  _UserGroup = "数据操作员"
            If c.name <> "身份证号" AndAlso c.name <> "客户主手机号" AndAlso  c.name <>"第二手机号" AndAlso c.name <> "第三手机号"  Then
                str &= c.name & "|"
            End If
        End If
    Else
        str &= c.name & "|"
    End If
Next
e.Form.Controls("lieCheckedListBox").ComboList = str.trim("|")

Dim ary = str.split("|")
Dim clist As WinForm.CheckedListBox = e.Form.Controls("lieCheckedListBox")
For Each c As Col In t.Table.Cols
    If t.Table.DataTable.Name ="客户资料" Then
        If _UserGroup ="系统管理员" OrElse _UserGroup = "数据管理员"   Then
            If c.name <>"身份证号掩码显示" AndAlso c.name <> "客户主手机号掩码显示" AndAlso c.name <> "第二手机号掩码显示"  AndAlso  c.name <> "第三手机号掩码显示" Then
                Dim i = array.Indexof(ary, c.name)
                liexz .SetItemChecked(i, not c.Visible)
            End If
        ElseIf  _UserGroup = "数据操作员"
            If c.name <> "身份证号" AndAlso c.name <> "客户主手机号" AndAlso  c.name <>"第二手机号" AndAlso c.name <> "第三手机号"  Then
                Dim i = array.Indexof(ary, c.name)
                liexz .SetItemChecked(i, not c.Visible)
            End If
        End If
    Else
        Dim i = array.Indexof(ary, c.name)
        If i >= 0 Then
            liexz .SetItemChecked(c.Index, not c.Visible)
        End If
    End If
Next


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


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

 

做一个例子发上来测试

 

 


 回到顶部
帅哥哟,离线,有人找我吗?
裴保民
  39楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1989 积分:12631 威望:0 精华:0 注册:2017/4/3 15:01:00
  发帖心情 Post By:2019/4/15 8:46:00 [只看该作者]

在“复选列表框”的ItemCheck事件写了如下代码 运行后发现,只要有隐藏列存在,在选择“复选列表框”的值的时候,选择的列就和数据表中的列不一致,看看哪错了

Dim t As Table = e.Form.controls("Table1").Table
Dim ldxsyyc As WinForm.RadioButton = e.Form.Controls("ldxsyycRadioButton")
Dim szldkdysx As WinForm.RadioButton = e.Form.Controls("szldkdysxRadioButton")
If szldkdysx.Checked Then
t.Select(0, e.Sender.SelectedIndex)
t.LeftVisibleCol = e.Sender.SelectedIndex
    If e.Checked Then
        Dim cst As WinForm.CheckedListBox = e.Sender
        For i As Integer = 0 To cst.Items.count - 1
            If i <> e.Index Then
              cst.SetItemChecked(i, False)
            End If
        Next
    End If
ElseIf ldxsyyc.Checked Then
    Return
End If
If t.rows.count > 0 Then
    t.Select(0,e.Index)
    t.LeftVisibleCol = e.Index
End If
[此贴子已经被作者于2019/4/15 8:46:16编辑过]

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


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

要说多少次?改成这样啊

 

Dim t As Table = e.Form.controls("Table1").Table
Dim cst As WinForm.CheckedListBox = e.sender
Dim c As Col = t.cols(cst.Items(e.index))
t.Select(-1, c.Index)
t.LeftVisibleCol = c.Index

 回到顶部
总数 40 上一页 1 2 3 4