Returns a tGridSortRules struct that defines the rules for sorting this column.
Function ColumnSortRules Returns tGridSortRules
| Call: | Get ColumnSortRules to tGridSortRulesVariable |
When a grid is sorted around a column, the message ColumnSortRules is sent to the grid column. This message returns the information needed to sort the grid. It does this by returning a tGridSortRules value.
By default, this function returns a single column segment based on the column. The function looks like this:
Function ColumnSortRules Returns tGridSortRules
tGridSortRules SortRules
Get piColumnId to SortRules.Rules[0].iColumn
Get peDataType to SortRules.Rules[0].eDataType
Function_Return SortRules
End_Function
If you wished, you could augment this to handle multiple segments in the sort. For example, you might augment this to add the oCustomerNumber segment to the end of each segment. You would augment all of your non-oCustomerNumber columns as follows:
Function ColumnSortRules Returns tGridSortRules
tGridSortRules SortRules
Forward Get ColumnSortRules to SortRules
// add another sort segment.
Get piColumnId of oCustomerNumber to SortRules.Rules[1].iColumn
Get peDataType of oCustomerNumber to SortRules.Rules[1].eDataType
Function_Return SortRules
End_Function
If iColumn is set to -1, the sort column is identified as the Row's RowId. Adding this a as a sort segment will not provide a meaningful order, but it will create a unique sort key and therefore a consistent sort order.
Function ColumnSortRules Returns tGridSortRules
tGridSortRules SortRules
Forward Get ColumnSortRules to SortRules
// define last segment as RowId.
Move -1 to SortRules.Rules[1].iColumn
Function_Return SortRules
End_Function
ColumnSortRules is only called when a grid needs to be sorted. If the grid is data-aware and non-static (pbStaticData is False), grid column reordering is done through table index ordering and this method is never called.