Sort Data

Handle Sort Event

Description
This customization demonstrates how to handle the sort event for the column sorting link at the top of a table panel.
Variables
Database Table
Select the database table displayed in the page
Table Control Class
Select a table control
Field Control
Select the field label corresponding to the field to be sorted
Field Name
Select the database field to be sorted
Applies to
TableControl class
Code
 
  ''' 
''' Override the ${Field Control}_Click to customize the sort order
''' 
Public Overrides Sub ${Field Control}_Click(ByVal sender As Object, ByVal args As EventArgs)
    Dim sd As OrderByItem = Me.CurrentSortOrder.Find(${${Database Table}ClassName}.${Field Name})    
    If Not sd Is Nothing Then
       sd.Reverse()
    Else
        Me.CurrentSortOrder.Reset()
       
        'Set the sort order for the selected field
        Me.CurrentSortOrder.Add(${${Database Table}ClassName}.${Field Name}, BaseClasses.Data.OrderByItem.OrderDir.Desc)        
    End If
    Me.DataChanged = True
End Sub


     

Terms of Service Privacy Statement