Skip to main content

getSortingStates()

returns an array of objects with the current parameters of sorting applied to the data

Usage

interface ISortingState {
by: string | number,
dir: "asc" | "desc",
as?: (a) => any,
rule?: (a, b) => number,
smartSorting?: boolean
}

getSortingStates(): ISortingState[];

Returns:

An array of objects with the current parameters of sorting applied to the data.

Example

const state = component.data.getSortingStates(); 

The array returned by the method contains objects with the following properties:

by(string | number) the id of a data field to sort by
dir(string) the direction of sorting: "asc" or "desc"
as(function) optional, a custom function of converting values before comparing
rule(function) optional, a custom sorting function
smartSorting(boolean) optional, (if applied) specifies whether a sorting rule should be applied each time after changing the data set

Change log:

added in v9.1