B4J Question B4J Refresh tableview

oldeast

Active Member
Licensed User
Longtime User
Hi all,
I import data from excel, but having read the refresh threads I can't work out how to refresh the data in the table view.
I read this post
B4X:
Dim 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)
        
        tv.Items.add(Array As Object(r(0), r(1), r(2)))
      Next

but it doesn't work
Could you direct me to a solution please.
 

oldeast

Active Member
Licensed User
Longtime User
Sorry Erel I wasn't clear.
I have a tableview showing data from an SQLite table, I update the table, how do I refresh the tableview?
Thanks
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
An example for you
B4X:
...
	Dim tv As TableView
	Dim li As List
	li.Initialize
	tv.Initialize("")
	tv.SetSize(400,300)
	tv.SetColumns(Array("one","two","three"))
	tv.SetColumnWidth(0,100)
	tv.SetColumnWidth(1,100)
	tv.SetColumnWidth(2,100)
	
	MainForm.RootPane.AddNode(tv,0,0,-1,-1)
	
	tv.Items.Add(Array(1,2,3)) ' item added to table view
	tv.Items.Add(Array(4,5,6))
	li = tv.items     ' tableview items saved into a list
	li.Add(Array(7,8,9))   ' new item added to the list NOT the table
	tv.Items = li      'Reload table items using the list no need to clear the table items
...
 
Upvote 0
Top