Android Question [SOLVED] Table Column Not hiding

makis_best

Well-Known Member
Licensed User
Hi

I try to hide a column from a table.
I use the code below but not working

B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Public PrefDialog1 As PreferencesDialog
    Private ItemTable_ESMMBOM As Table
End Sub

Sub All_Items_Sambania(LookingFor As String)
    Dim SQlScript As String
    Dim Curs1 As Cursor
    ItemTable_ESMMBOM.InitializeTable(7, Gravity.CENTER, False)
    ItemTable_ESMMBOM.SetHeader(Array As String("xxx", "xxx", "xxx", "xxx", "xxx", "xxx", "xxx"))
    ItemTable_ESMMBOM.SetColumnsWidths(Array As Int(70dip, 200dip, 60dip, 80dip, 110dip, 250dip, 100dip))
    ItemTable_ESMMBOM.hideCol(6)
    ItemTable_ESMMBOM.SortColumn = False
.....
.....
End Sub
 

klaus

Expert
Licensed User
I suppose you are using the Flexible Table class.
I tested the hideCol method in the demo project and it works.
Please post your test project so we could see what exactly you have done.
 

makis_best

Well-Known Member
Licensed User
I am Using the

'Table CustomView
'Version 3.02
'Amended as error, cTypeFace
'
'Version 3.01
'Amended setSingleLine problem
and all the code is

B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Private ItemTable_ESMMBOM As Table
End Sub

Sub Activity_Create(FirstTime As Boolean)
    All_Items_Sambania("none999")
    
End Sub

Sub All_Items_Sambania(LookingFor As String)
    Dim SQlScript As String
    Dim Curs1 As Cursor
    ItemTable_ESMMBOM.InitializeTable(7, Gravity.CENTER, False)
    ItemTable_ESMMBOM.SetHeader(Array As String("xxxx", "xxxx", "xxxx", "xxxxx", "xxxxx", "xxxxx", "xxxxx"))
    ItemTable_ESMMBOM.SetColumnsWidths(Array As Int(70dip, 200dip, 60dip, 80dip, 110dip, 250dip, 100dip))
    ItemTable_ESMMBOM.hideCol(6)
    ItemTable_ESMMBOM.SortColumn = False
    SQlScript = $"Select xxxx, xxxx, xxxx, xxxx FROM T1"$
    Starter.LocalSQL.Initialize(File.DirRootExternal & "/DroidViewDB/", "DVDatabase.db", True)
    Curs1 = Starter.LocalSQL.ExecQuery(SQlScript)
    'Log(Curs1.RowCount)
    For ii = 0 To Curs1.RowCount - 1
        Curs1.Position = ii
        ItemTable_ESMMBOM.AddRowAutomaticWidth(Array As String(Curs1.GetString("xxxx"), Curs1.GetString("xxxxx"), _
        Curs1.GetString("xxxxx"), "", "xxxxxxx", "", Curs1.GetString("xxxx")))
    Next
End Sub
 
Last edited:

klaus

Expert
Licensed User
Move ItemTable_ESMMBOM.hideCol(6) after the For / Next loop.

Why do you define a table with 7 colums but, you read 4 columns and try to fill 5 columns, strange?

You define the column widths with SetColumnsWidths and then you use AddRowAutomaticWidth?
Do you want automatic widths or the predefined widths?

The Table class has methods to load directly SQLite database query results.
 

makis_best

Well-Known Member
Licensed User
Why do you define a table with 7 colums but, you read 4 columns and try to fill 5 columns, strange?
I want to have empty columns.

You define the column widths with SetColumnsWidths and then you use AddRowAutomaticWidth?
I want to use SetColumnsWidths the AddRowAutomaticWidth it is my mistake... I didn't notice.

The Table class has methods to load directly SQLite database query results.
I din't know that. I check.

Move ItemTable_ESMMBOM.hideCol(6) after the For / Next loop.
That works.

Thank you.
 
Top