Class: ColumnSorting

ColumnSorting

handsontable/src/plugins/columnSorting/columnSorting.js, line 53

This plugin sorts the view by a column (but does not sort the data source!).
To enable the plugin, set the columnSorting property to either:

  • a boolean value (true/false),
  • an object defining the initial sorting order (see the example below).
Example
...
// as boolean
columnSorting: true
...
// as a object with initial order (sort ascending column at index 2)
columnSorting: {
 column: 2,
 sortOrder: 'asc', // 'asc' = ascending, 'desc' = descending, 'none' = original order
 sortEmptyCells: true // true = the table sorts empty cells, false = the table moves all empty cells to the end of the table
}
...

Members

rowsMapperRowsMapper

Object containing visual row indexes mapped to data source indexes.

sortColumn

Visual index of last sorted column.

sortEmptyCellsBoolean

Sorting empty cells.

sortOrderString

Order of last sorting. For asc ascending order, for desc descending order, for none the original order.

Methods

handsontable/src/plugins/columnSorting/columnSorting.js, line 520

destroy()

Destroy plugin instance.

handsontable/src/plugins/columnSorting/columnSorting.js, line 139

disablePlugin()

Disable plugin for this Handsontable instance.

handsontable/src/plugins/columnSorting/columnSorting.js, line 102

enablePlugin()

Enable plugin for this Handsontable instance.

handsontable/src/plugins/columnSorting/columnSorting.js, line 95

isEnabled(){Boolean}

Check if the plugin is enabled in the handsontable settings.

Returns: {Boolean}
handsontable/src/plugins/columnSorting/columnSorting.js, line 178

isSorted(){Boolean}

Check if any column is in a sorted state.

Returns: {Boolean}
handsontable/src/plugins/columnSorting/columnSorting.js, line 207

loadSortingState(){*}

Load the sorting state.

Returns: {*} Previously saved sorting state.
handsontable/src/plugins/columnSorting/columnSorting.js, line 185

saveSortingState()

Save the sorting state.

handsontable/src/plugins/columnSorting/columnSorting.js, line 149

sort(column, order)

Sorting the table by chosen column and order.

Parameters:
Name Type Description
column Number

Visual column index.

order undefined | String

Sorting order (asc for ascending, desc for descending and none for initial state).