ColumnStatesManager

Store and manages states of sorted columns.

Members

compareFunctionFactory

Determines compare function factory. Method get as parameters sortOder and columnMeta and return compare function.

headerActionboolean

Determines whether click on the header perform sorting.

hotCore

Handsontable instance.

indicatorboolean

Determines whether indicator should be visible (for sorted columns).

mapName

Name of map storing sorting states. Required for unique name (PR #7440 introduced it). It's needed as
both ColumnSorting and MultiColumnSorting plugins create state manager and as a consequence register maps.
Objects are destroyed in strange order as the updateSettings doesn't work well.

sortEmptyCellsboolean

Determines whether we should sort empty cells.

Index map storing sorting states for every column. ColumnStatesManager write and read to/from this element.

Methods

destroy()

Destroy the state manager.

getAllColumnsProperties(){object}

Get all column properties which affect the sorting result.

Returns: {object}

getColumnSortState(column){object|undefined}

Get sort state for particular column. Object contains column and sortOrder properties.

Note: Please keep in mind that returned objects expose visual column index under the column key.

Parameters:
Name Type Description
column number

Visual column index.

Returns: {object|undefined}

getIndexOfColumnInSortQueue(column){number}

Get order of particular column in the states queue.

Parameters:
Name Type Description
column number

Visual column index.

Returns: {number}

getNumberOfSortedColumns(){number}

Get number of sorted columns.

Returns: {number}

getSortOrderOfColumn(searchedColumn){string|undefined}

Get sort order of column.

Parameters:
Name Type Description
searchedColumn number

Visual column index.

Returns: {string|undefined} Sort order (asc for ascending, desc for descending and undefined for not sorted).

getSortStates(){Array.<object>}

Queue of sort states containing sorted columns and their orders (Array of objects containing column and sortOrder properties).

Note: Please keep in mind that returned objects expose visual column index under the column key.

Returns: {Array.<object>}

isColumnSorted(column){boolean}

Get if particular column is sorted.

Parameters:
Name Type Description
column number

Visual column index.

Returns: {boolean}

isListOfSortedColumnsEmpty(){boolean}

Get if list of sorted columns is empty.

Returns: {boolean}

setSortStates(sortStates)

Set all column states.

Parameters:
Name Type Description
sortStates Array

Sort states.

updateAllColumnsProperties(allSortSettings)

Update column properties which affect the sorting result.

Note: All column properties can be overwritten by columns option.

Parameters:
Name Type Description
allSortSettings object

Column sorting plugin's configuration object.

Class: ColumnStatesManager