Skip to main content

sortMarks

sortMarks

Description

Adds sort indicators to column headers

sortMarks is generated by the sort-rows action automatically when the user clicks column headers. If you want to indicate the sorting direction of data that has already been sorted externally (outside the Grid), you can use the sortMarks property to display sort indicators in the column headers. It means that setting sortMarks manually does not sort the data — it only shows the sort icons in the header.

Usage

sortMarks: {
[key: string]: {
order: "asc" | "desc";
index?: number; // for multi-column sorting, starts from 0
};
}

Parameters

sortMarks is an object with the next parameters:

  • key - name of the field
  • order - the sorting direction
  • index - for the single field there is no index, for multiple - the order of fields and index starts from 0

Example

<Grid {data} {columns} sortMarks={{ date: { order: "asc" } }} />

Related articles: sort-rows