' Hides the requested column from view.
Public Sub HideColumn(ColID As String)
Dim poCol As B4XTableColumn = B4XTable1.GetColumn(ColID)
If poCol <> Null And poCol.IsInitialized Then
Dim piVisibleColIndex As Int = B4XTable1.VisibleColumns.IndexOf(poCol)
If piVisibleColIndex >= 0 Then
B4XTable1.VisibleColumns.RemoveAt(piVisibleColIndex) 'hide column
If B4XTable1.clvData.IsInitialized Then
If B4XTable1.clvData.Size > piVisibleColIndex Then
B4XTable1.clvData.RemoveAt(piVisibleColIndex)
End If
End If
poCol.Panel.RemoveViewFromParent
End If
B4XTable1.Refresh
End If
End Sub
' Shows a hidden column, if InsertIndex = -1 then the column will be added to the end of the column list.
Public Sub ShowColumn(ColID As String, InsertIndex As Int)
Dim poCol As B4XTableColumn = B4XTable1.GetColumn(ColID)
If poCol <> Null And poCol.IsInitialized Then
Dim piVisibleColIndex As Int = B4XTable1.VisibleColumns.IndexOf(poCol)
If piVisibleColIndex < 0 Then
If InsertIndex < 0 Then
B4XTable1.VisibleColumns.Add(poCol)
B4XTable1.clvData.Add(poCol.Panel, poCol)
Else
B4XTable1.VisibleColumns.InsertAt(InsertIndex, poCol)
B4XTable1.clvData.InsertAt(InsertIndex, poCol.Panel, poCol)
End If
End If
B4XTable1.Refresh
End If
End Sub