Skip to content

HeaderReorder - cCJGrid

Reorders the grid based on the passed column

Type: Procedure

Parameters

Parameter Type Description
iCol Integer The column index to reorder

Syntax

Procedure HeaderReorder Integer iCol

Call Example

Send HeaderReorder iCol

Description

HeaderReorder is sent to change the grid order based on the ordering/sorting rules of the object and the column. Normally it is sent when the user clicks on a header column. This sends the OnHeaderClick event, which sends HeaderReorder, passing the selected column. Depending on the state of the grid and the grid column it may change sort order, change order direction or do nothing.

The behavior for a cCJGrid and cDbCJGrid are different:

cCJGrid Behavior

If pbHeaderReorders is False, this will return, doing nothing.

If pbHeaderReorders is True, the current sort column (piSortColumn) will be compared to the passed column number. If they are different, the datasource will be sorted. If the columns are the same and pbHeaderTogglesDirection is True, the datasource will be sorted in reverse order. The message SortGridByColumn performs the sort and display.

cDbCJGrid Behavior

If pbHeaderReorders is False, this will return, doing nothing.

If pbHeaderReorders is True, the grid will either be sorted or re-ordered. If the grid is static, meaning that all data is loaded in the grid and the data is static, this message is forwarded to its superclass, cCJGrid, which performs a datasource sort as described above.

If the grid is not static, the index ordering of the grid will be changed. In this case, the datasource is refreshed using the new index ordering. The current sort column (piSortColumn) will be compared to the passed column number. If they are different, the datasource will be refreshed around a new index order. If the columns are the same and pbHeaderTogglesDirection is True, the datasource will be ordered in reverse order. The message ReorderGridByColumn performs the reordering and display. The index order is determined by the column object. If there is no good order for column, nothing changes.