'SHOULD hide even header columns.
For i = B4XTable1.VisibleColumns.Size - 1 To 0 Step - 2
B4XTable1.VisibleColumns.RemoveAt(i)
B4XTable1.Columns.Get(i).As(B4XTableColumn).Panel.Visible = False '<== Add
Next
Private Sub Button1_Click
' Resets visible columns.
Dim toggle As Boolean = B4XTable1.VisibleColumns.Size = 10
B4XTable1.VisibleColumns.Clear
For Each clm As B4XTableColumn In B4XTable1.Columns
B4XTable1.VisibleColumns.Add(clm)
clm.Panel.visible = True
Next
If toggle Then
'SHOULD hide even header columns.
For i = B4XTable1.VisibleColumns.Size - 1 To 0 Step - 2
B4XTable1.VisibleColumns.RemoveAt(i)
B4XTable1.Columns.Get(i).As(B4XTableColumn).Panel.Visible = False '<== Add
Next
B4XTable1.Refresh
End If
lblVisibleColumns.Text = "Visible columns = " & B4XTable1.VisibleColumns.Size
End Sub
Note that even columns are displayed last (no longer in order).OK got it.
Private Sub Button1_Click
' Resets visible columns
Dim toggle As Boolean = B4XTable1.VisibleColumns.Size = 10
B4XTable1.VisibleColumns.Clear
For Each clm As B4XTableColumn In B4XTable1.Columns
B4XTable1.VisibleColumns.Add(clm)
clm.Panel.visible = True
Next
If toggle Then
'SHOULD hide even header columns.
For i = B4XTable1.VisibleColumns.Size - 1 To 0 Step - 2
B4XTable1.VisibleColumns.RemoveAt(i)
B4XTable1.Columns.Get(i).As(B4XTableColumn).Panel.Visible = False '<== Add
Next
End If
B4XTable1.Refresh '<== Move to here
lblVisibleColumns.Text = "Visible columns = " & B4XTable1.VisibleColumns.Size
End Sub
I thought I would find your solution here, this morning; a bit like you were dressed in red, with a big belly and a long white beard ? ?The feature you are trying to implement isn't directly supported. VisibleColumns is not expected to change after SetData was called.
You will either need to manually modify the layout as @William Lancee did or clear the table and call SetData again.
The table acts as a user interface element and as a data store. The VisibleColumns list allows the developer to include data that will not be displayed, but will still be accessible programmatically.Ok, I understand your answer; however, I am not very clear about the usefulness of VisibleColumns: they are all the columns, since you cannot scroll the columns horizontally, right?