Skip to main content
A newer version of this page is available. .

ASPxClientGridView.SortBy(column) Method

Sorts data by the specified data column‘s values, and places the column to the specified position among the sorted columns.

Declaration

SortBy(
    column: ASPxClientGridViewColumn | number | string,
    sortOrder?: string,
    reset?: boolean,
    sortIndex?: number
): void

Parameters

Name Type Description
column ASPxClientGridViewColumn | number | string

An ASPxClientGridViewColumn object that represents the data column.

sortOrder string

A string value that specifies the column’s sort order (‘ASC’, ‘DSC’ or ‘NONE’).

reset boolean

true to clear any previous sorting; otherwise, false.

sortIndex number

An integer value that specifies the zero-based column’s index among the sorted columns. -1 if data is not sorted by this column.

Remarks

The ASPxGridView allows data sorting by multiple columns. Any previous sorting is not cleared if the reset parameter isn’t set to true. The newly sorted column is inserted at the specified position within the collection of sorted columns. Its position within the collection can then be changed using the GridViewDataColumn.SortIndex property.

To sort column values in ascending or descending order, set the sortOrder parameter to ‘ASC’ or ‘DSC’, respectively. To clear sorting, set this parameter to ‘NONE’.

Sorting is allowed if the ASPxGridBehaviorSettings.AllowSort property is set to true.

function ProcessSorting(s, e, grid) {
    ...
    grid.SortBy(e.column.name);
    ...
}
See Also