WebListBox.HeaderPressed
From Xojo Documentation
Event
WebListBox.HeaderPressed(column As Integer)
New in 2014r1
Supported for all project types and targets.
New in 2014r1
Supported for all project types and targets.
Called when a WebListBox header has been pressed. The index on column is zero-based. You can use this event to sort the column that was pressed.
Example
When the header is pressed, the sort order is changed and the data reloaded:
mSortAscending = Not mSortAscending // Property on Web Page
mValues.Sort // Property array on Web Page with string values to display
If Not mSortAscending Then
// Reverse the data
Var descValues() As String
For i As Integer = mValues.LastRowIndex DownTo 0
descValues.Add(mValues(i))
Next
mValues = descValues
End If
// Remove existing data
Me.RemoveAllRows
// Reload data in newly sorted order
For i As Integer = 0 To mValues.LastRowIndex
Me.AddRow(mValues(i))
Next
mValues.Sort // Property array on Web Page with string values to display
If Not mSortAscending Then
// Reverse the data
Var descValues() As String
For i As Integer = mValues.LastRowIndex DownTo 0
descValues.Add(mValues(i))
Next
mValues = descValues
End If
// Remove existing data
Me.RemoveAllRows
// Reload data in newly sorted order
For i As Integer = 0 To mValues.LastRowIndex
Me.AddRow(mValues(i))
Next