Skip to content

ReorderGridByColumn - cDbCJGrid

Used to change the ordering of an active grid based on a column ordering

Type: Procedure

Parameters

Parameter Type Description
hoCol Handle The column object handle that will determine the ordering
bDescending Boolean Set true to reverse the index order

Syntax

Procedure ReorderGridByColumn Handle hoCol Boolean bDescending

Call Example

Send ReorderGridByColumn hoCol bDescending

Description

ReorderGridByColumn is used to change the order of an active grid based on the preferred ordering of a column. It does this by determining the preferred ordering of a column (ColumnOrdering) and calling ChangeOrdering. Calling this will set piSortColumn, Ordering and pbReverseOrdering.

This is called by HeaderReorder, which is called when clicking on a header column.

You probably do not want to call this if your grid is static (pbStaticData is true) as this will reload and refresh your grid. Static grids are sorted by calling SortGridByColumn.

After a grid is activated, changing Ordering does not change the grid's order. You must use ReorderGridByColumn or ChangeOrdering.

Sample

This sample shows how to change the default ordering of a grid.

This code will reorder a grid by index 1 and in descending order. This can be used in cDbCJGrid and cDbCJGridPromptList classes. Add the code directly to the grid object.

Procedure Activating
    Forward Send Activating
    Send ChangeOrdering 1 True
End_Procedure