Skip to content

SortGridByColumn - cCJGrid

Sorts a static grid based on the sort rules of a column object

Type: Procedure

Parameters

Parameter Type Description
hoCol Handle The column that should be sorted
bDescending Boolean If true, sort in descending order

Syntax

Procedure SortGridByColumn Handle hoCol Boolean bDescending

Call Example

Send SortGridByColumn hoCol bDescending

Description

SortGridbyColumn sorts a grid based on the sorting rules for the passed column object. The rows can be sorted in ascending or descending order. This sorts the data in the datasource; therefore, this message should only be used with static grids such as a cCJGrid or a cDbCJGrid with pbStaticData set to true. It will take time to sort the datasource and the bigger the datasource the longer the sort will take. This must be taken into account before choosing to sort a grid.

The sort maintains the same SelectedColumn and the same physical SelectedRow. The SelectedRow will actually change, but it will continue to point to the same physical row in the datasource array.

The sort rules for the sort are obtained by sending ColumnSortRules to the hoCol column object. ColumnSortRules returns an array of struct values that instructs the grid how to sort the columns. Normally, it just sorts the data based on datatype appropriate comparisons of data in the one column.

This is the message that is used by HeaderReorder to sort static grids.