This release contains changes to the ColumnSorting
plugin exclusively. Detailed information about the changes can be found in the description of pull request #5411 and in our documentation.
Breaking Changes
- We refactored and rewrote parts of the
ColumnSorting
plugin in order for it to work seamlessly with the newMultiColumnSorting
plugin for Handsontable Pro. This allowed us to fix multiple problems that the previous version of the plugin had.
This introduced some backward-incompatible changes:- The configuration items (such as
sortIndicator
,sortEmptyCells
,sortFunction
) for the plugin were moved into the scope of the plugin config. - The initial plugin configuration is stored under the
initialConfig
property in the plugin configuration. - The
sortFunction
config item was renamed tocompareFunctionFactory
and converted to a factory returning a compare function (and moved into the plugin configuration scope, as mentioned above). - The
sortIndicator
config item was renamed toindicator
(and moved into the plugin configuration scope, as mentioned above). - Comparator function structure changed:
// Was: function numericSort(sortOrder, columnMeta) { return function ([, value], [, nextValue]) { // Is: function numericSort(sortOrder, columnMeta) { return function (value, nextValue) {
- The
sort
method arguments were reorganized, so it accepts the sorting configuration as an object:
hot.getPlugin('columnSorting').sort({ column: 0, sortOrder: 'asc' });
- Some public methods were rewritten, renamed and set as private, namely:
getNextOrderState
loadSortingState
saveSortingState
- The
beforeColumnSort
andafterColumnSort
hooks receive a different set of arguments. For more information, check our documentation. - Calling the
updateSettings
method withcolumnSorting
defined will set a fresh sort configuration.
- The configuration items (such as
Changes
Apart from the breaking changes above, this release introduces some additional changes to the sorting plugin:
- Replaced the current sorting indicators with new ones, in the form of arrows.
- The sorting indicators will be displayed by default.
- Added a possibility to disable the action of sorting by clicking on the headers, using the
headerAction
option.