Hi Erel,
a tableview with two columns is defined. For a cell in the tableview a new value is assigned using:
The new value is not displayed, so the itemlist has to be refreshed. Using Sub A below works where as Sub B is not working. The difference between the two is the use of Items.Add.
The goal is to use Sub B as it provides flexibility in the number of columns in the tableview.
In Sub A these are hard coded for the two columns.
Any hint on how to get Sub B working?
a tableview with two columns is defined. For a cell in the tableview a new value is assigned using:
B4X:
Sub setTableviewNewValue(tv As TableView, Row As Int, Cell As Int, newvalue As String)
tv.SelectedRow = Row
Dim rowcontent() As Object = tv.Items.get(Row)
rowcontent(Cell) = newvalue
End Sub
The new value is not displayed, so the itemlist has to be refreshed. Using Sub A below works where as Sub B is not working. The difference between the two is the use of Items.Add.
The goal is to use Sub B as it provides flexibility in the number of columns in the tableview.
In Sub A these are hard coded for the two columns.
Any hint on how to get Sub B working?
B4X:
Sub refreshTableViewA(tv As TableView)
Dim tvl As List
tvl.Initialize
tvl.AddAll(tv.Items)
tv.Items.Clear
For i = 0 To tvl.Size - 1
Dim r() As Object = tvl.get(i)
' THIS WORKS
tv.Items.add(Array As Object(r(0), r(1)))
Next
End Sub
Sub refreshTableViewB(tv As TableView)
Dim tvl As List
tvl.Initialize
tvl.AddAll(tv.Items)
tv.Items.Clear
For i = 0 To tvl.Size - 1
Dim r() As Object = tvl.get(i)
' THIS NOT WORKING !!!
tv.Items.Add(r)
Next
End Sub