ITreeControl.Sort

Syntax

Sort([Column: ITreeListColumn = Null;][Direction: SortDirection = 0]);

Parameters

Column. Column, by which sorting must be executed. If the parameter is not specified, sorting is executed by the column specified in the SortColumn property.

Direction. The direction of sorting that is set in the column. If the parameter is not specified, the ascending sorting is set.

Description

The Sort method sorts elements of the specified column in the specified direction.

Comments

The Sort method is relevant if the Sorted property is set to True, and the SortType property is set to a value other than None.

Example

Executing the example requires a form, a button named Button1 on it and the TreeList component named TreeList1.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Begin
    TreeList1.SortType := ControlSortType.Text;
    TreeList1.Sorted := True;
    TreeList1.Sort(TreeList1.Columns.Item(0), SortDirection.Descending);
End Sub Button1OnClick;

Clicking the button executes descending sorting. Sorting is executed by the first column.

See also:

ITreeControl