Class: ColumnSorting

ColumnSorting

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

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: true // true = ascending, false = descending, undefined = original order
}
...

Methods

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

bindColumnSortingAfterClick()

Bind the events for column sorting.

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

dateSort(sortOrder){function}

Date sorting algorithm

Parameters:
Name Type Description
sortOrder Boolean

Sorting order (true for ascending, false for descending)

Returns: {function} The compare function.
handsontable/src/plugins/columnSorting/columnSorting.js, line 296

defaultSort(sortOrder){function}

Default sorting algorithm.

Parameters:
Name Type Description
sortOrder Boolean

Sorting order - true for ascending, false for descending.

Returns: {function} The comparing function.
handsontable/src/plugins/columnSorting/columnSorting.js, line 109

disablePlugin()

Disable plugin for this Handsontable instance.

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

enablePlugin()

Enable plugin for this Handsontable instance.

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

isEnabled(){Boolean}

Check if the plugin is enabled in the handsontable settings.

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

isSorted(){Boolean}

Check if any column is in a sorted state.

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

loadSortingState(){*}

Load the sorting state.

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

numericSort(sortOrder){function}

Numeric sorting algorithm.

Parameters:
Name Type Description
sortOrder Boolean

Sorting order (true for ascending, false for descending)

Returns: {function} The compare function.
handsontable/src/plugins/columnSorting/columnSorting.js, line 192

saveSortingState()

Save the sorting state

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

setSortingColumn(col, order)

Set sorted column and order info

Parameters:
Name Type Description
col number

Sorted column index.

order boolean | undefined

Sorting order (true for ascending, false for descending).

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

sort()

Perform the sorting.

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

translateRow(row){Number}

modifyRow hook callback. Translates physical row index to the sorted row index.

Parameters:
Name Type Description
row Number

Row index.

Returns: {Number} Sorted row index.
handsontable/src/plugins/columnSorting/columnSorting.js, line 480

untranslateRow(row){number}

Translates sorted row index to physical row index.

Parameters:
Name Type Description
row Number

Sorted row index.

Returns: {number} Physical row index.
handsontable/src/plugins/columnSorting/columnSorting.js, line 224

updateOrderClass()

Update sorting class name state.

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

updateSortIndicator()

Update indicator states.