The plugin allows filtering the table data either by the built-in component or with the API.
See the filtering demo for examples.
Example
const container = document.getElementById('example');
const hot = new Handsontable(container, {
data: getData(),
colHeaders: true,
rowHeaders: true,
dropdownMenu: true,
filters: true
});
Methods
-
clearConditions(column)
-
Clears all conditions previously added to the collection for the specified column index or, if the column index
was not passed, clear the conditions for all columns.Parameters:
Name Type Description column
number optional Visual column index.
-
destroy()
-
Destroys the plugin instance.
-
disablePlugin()
-
Disables the plugin functionality for this Handsontable instance.
-
enablePlugin()
-
Enables the plugin functionality for this Handsontable instance.
-
filter()
-
Filters data based on added filter conditions.
Fires:
-
getDataMapAtColumn(column){Array}
-
Returns handsontable source data with cell meta based on current selection.
Parameters:
Name Type Description column
number optional Column index. By default column index accept the value of the selected column.
Returns: {Array} Returns array of objects where keys as row index.
-
getSelectedColumn(){object|null}
-
Gets last selected column index.
Returns: {object|null} Return
null
when column isn't selected otherwise
object containing information about selected column with keysvisualIndex
andphysicalIndex
. -
isEnabled(){boolean}
-
Checks if the plugin is enabled in the handsontable settings. This method is executed in
Hooks#beforeInit
hook and if it returnstrue
than theFilters#enablePlugin
method is called.Returns: {boolean}
-
removeConditions(column)
-
Removes conditions at specified column index.
Parameters:
Name Type Description column
number Visual column index.