Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
B4XTable1.AddColumn("col 1", B4XTable1.COLUMN_TYPE_NUMBERS)
B4XTable1.AddColumn("col 2", B4XTable1.COLUMN_TYPE_NUMBERS)
B4XTable1.AddColumn("col 3", B4XTable1.COLUMN_TYPE_NUMBERS)
Dim data As List
data.Initialize
For i = 1 To 88
data.Add(Array(Rnd(1, 10), Rnd(1, 10), Rnd(1, 10)))
Next
B4XTable1.SetData(data)
End Sub
Private Sub B4XTable1_CellClicked (ColumnId As String, RowId As Long)
Dim value As Object = B4XTable1.GetRow(RowId).Get(ColumnId)
SetLabelsState(value)
End Sub
Private Sub SetLabelsState(Value As Object)
For row = 0 To B4XTable1.VisibleRowIds.Size - 1
Dim rowid As Long = B4XTable1.VisibleRowIds.Get(row)
Dim rowdata As Map = B4XTable1.GetRow(rowid)
For Each col As B4XTableColumn In B4XTable1.Columns
Dim v As Object = rowdata.Get(col.Id) 'can be null
Dim lbl As B4XView = col.CellsLayouts.Get(row + 1).As(B4XView).GetView(col.LabelIndex) 'note the +1 because of the header
lbl.Font = IIf(Value = v, xui.CreateDefaultBoldFont(B4XTable1.LabelsFont.Size), B4XTable1.LabelsFont)
lbl.TextColor = IIf(Value = v, xui.Color_Blue, B4XTable1.TextColor)
Next
Next
End Sub
Private Sub B4XTable1_DataUpdated
SetLabelsState("")
End Sub