Foxtable(狐表)用户栏目专家坐堂 → [求助]带目录树节点的动态筛选并分页加载


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

主题:[求助]带目录树节点的动态筛选并分页加载

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


加好友 发短信
等级:四尾狐 帖子:820 积分:5641 威望:0 精华:1 注册:2015/11/28 14:00:00
[求助]带目录树节点的动态筛选并分页加载  发帖心情 Post By:2016/8/26 16:39:00 [只看该作者]

Dim txt As String = e.Form.Controls("过滤值").Text
Dim tbl As DataTable = DataTables("tabDIYTable24")
Dim sxxm As String = e.Form.Controls("过滤项目").text
Dim ftxt As String
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
Dim tb As WinForm.TreeNode = trv.SelectedNode
Dim i As Integer = tb.Level
If txt = "" And tb.Text <> "所有分类" And i = 0 Then
    ftxt = "F128" & " = " & tb.Text
Else If txt = "" And tb.Text <> "所有分类" And i = 1 Then
    ftxt = "F128" & " = " & tb.ParentNode.Text & "F126" & " = " & tb.Text
Else If txt <> "" And tb.Text <> "所有分类" And i = 0 Then
    txt = "'%" & txt & "%'"
    For Each cl As DataCol In DataTables("tabDIYTable24").DataCols
        If cl.Caption = sxxm Then
            ftxt = cl.Name & " Like " & txt & "F128" & " = " & tb.Text
        End If
    Next
Else If txt <> "" And tb.Text <> "所有分类" And i = 1 Then
    txt = "'%" & txt & "%'"
    For Each cl As DataCol In DataTables("tabDIYTable24").DataCols
        If cl.Caption = sxxm Then
            ftxt = cl.Name & " Like " & txt & "F128" & " = " & tb.ParentNode.Text & "F126" & " = " & tb.Text
        End If
    Next
Else If  txt <> "" And tb.Text = "所有分类" Then
    txt = "'%" & txt & "%'"
    For Each cl As DataCol In DataTables("tabDIYTable24").DataCols
        If cl.Caption = sxxm Then
            ftxt = cl.Name & " Like " & txt
        End If
    Next
Else
    ftxt = ""
End If
With DataTables("tabDIYTable24")
    .LoadFilter = ftxt '一定要清除加载条件
    .LoadTop = 15
    .LoadPage = 0
    .Load()
End With

上面代码要么提示F128处语法错误,要么提示未将对像引用设置到对像的实例,求解决方法并简化代码。F128和F126是表tabDIYTable24中的列名。


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

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/8/26 17:04:00 [只看该作者]

Dim txt As String = e.Form.Controls("过滤值").Text
Dim tbl As DataTable = DataTables("tabDIYTable24")
Dim sxxm As String = e.Form.Controls("过滤项目").text
Dim ftxt As String
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
Dim tb As WinForm.TreeNode = trv.SelectedNode
Dim i As Integer = tb.Level
If txt = "" And tb.Text <> "所有分类" And i = 0 Then
    ftxt = "F128" & " = '" & tb.Text & "'"
Else If txt = "" And tb.Text <> "所有分类" And i = 1 Then
    ftxt = "F128" & " = '" & tb.ParentNode.Text & "' and F126" & " = '" & tb.Text & "'"
Else If txt <> "" And tb.Text <> "所有分类" And i = 0 Then
    txt = "'%" & txt & "%'"
    For Each cl As DataCol In DataTables("tabDIYTable24").DataCols
        If cl.Caption = sxxm Then
            ftxt = cl.Name & " Like " & txt & " and F128" & " = '" & tb.Text & "'"
        End If
    Next
Else If txt <> "" And tb.Text <> "所有分类" And i = 1 Then
    txt = "'%" & txt & "%'"
    For Each cl As DataCol In DataTables("tabDIYTable24").DataCols
        If cl.Caption = sxxm Then
            ftxt = cl.Name & " Like " & txt & " and F128" & " = '" & tb.ParentNode.Text & "' and F126" & " = '" & tb.Text & "'"
        End If
    Next
Else If  txt <> "" And tb.Text = "所有分类" Then
    txt = "'%" & txt & "%'"
    For Each cl As DataCol In DataTables("tabDIYTable24").DataCols
        If cl.Caption = sxxm Then
            ftxt = cl.Name & " Like " & txt
        End If
    Next
Else
    ftxt = ""
End If
With DataTables("tabDIYTable24")
    .LoadFilter = ftxt '一定要清除加载条件
    .LoadTop = 15
    .LoadPage = 0
    .Load()
End With

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


加好友 发短信
等级:四尾狐 帖子:820 积分:5641 威望:0 精华:1 注册:2015/11/28 14:00:00
  发帖心情 Post By:2016/8/27 9:05:00 [只看该作者]

非常感谢!这一个窗口做了一周,真不容易。


 回到顶部