Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private TableView1 As TableView
Type TableHelper (SortColumn As Object, TableRow() As Object)
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("1") 'Layout with a table named TableView1
MainForm.Show
TableView1.SetColumns(Array As String("col1", "col2", "col3"))
For i = 1 To 500
TableView1.Items.Add(Array As Object("Item " & i, Rnd(0, 100), Rnd(0, 100)))
Next
SortTable(TableView1, 1)
End Sub
Sub SortTable(tv As TableView, ColumnIndex As Int)
Dim list1 As List
list1.Initialize
For Each row() As Object In tv.Items
Dim th As TableHelper
th.SortColumn = row(ColumnIndex)
th.TableRow = row
list1.Add(th)
Next
list1.SortType("SortColumn", True)
tv.Items.Clear
For Each th As TableHelper In list1
tv.Items.Add(th.TableRow)
Next
End Sub