Private Sub btnNew_Click (e As BANanoEvent)
Dim Head As Map = CreateMap()
*VueTable1.Clear (this clears the rows on the table ONLY this line can be removed as .Reset below also does it)
VueTable1.Reset 'this clears everything on the table including the row data and headers
Dim CasualAsciiValue As Int = Rnd(1,20)
Dim Letter As String = Chr(64+CasualAsciiValue)
For i=1 To Rnd(5,15)
Dim NameField As String = Letter.ToLowerCase & i
Dim title As String = Chr(64+i)
Head.Put(NameField, title)
VueTable1.AddColumn(NameField,title)
Next
* home.BindVueTable(VueTable1) (because vuetable1.BindState is used on initialize, this can be removed)
vuetable1.UpdateHeaders (added)
* VueTable1.GetData.Clear (this is not necessary as it has been called twice, with .Clear and .Reset above, .Reset will suffice)
'as the code below adds 1 row at a time, lets create a list and use that to add rows in one go. There is nothing wrong / amiss im just indicating another option.
'If you want to add many many rows, DONT use the .AddItem method, use the List first approach. .AddItem is very useful where for example one would have a table that 'will be updated in real-time e.g. a stock data view etc where you want to see changes as and when they happen in realtime.
dim lst as List (added)
lst.Initialize (added)
For i=1 To 10
Dim TableRow As Map = CreateMap()
For Each field As String In Head.Keys
Dim V As String = Head.Get(field) & I
TableRow.Put(field, V)
Next
VueTable1.AddItem(TableRow) (replace with lst.add(TableRow))
Next
vuetable1.Reload(lst)
End Sub
Overall, this is very good progress, congrats.