Class: Filters

Filters

This plugin allows filtering the table data either by the built-in component or with the API.

handsontable-pro/src/plugins/filters/filters.js, line 24

Members

actionBarComponentActionBarComponent

Instance of ActionBarComponent.

conditionComponentConditionComponent

Instance of ConditionComponent.

Instance of DropdownMenu.

eventManagerEventManager

Instance of EventManager.

formulaCollectionFormulaCollection

Instance of FormulaCollection.

formulaUpdateObserverFormulaUpdateObserver

Instance of FormulaUpdateObserver.

lastSelectedColumnNumber

Last selected column index for added filter formulas.

Default Value:
  • null

trimRowsPluginTrimRows

Instance of TrimRows.

valueComponentValueComponent

Instance of ValueComponent.

Methods

handsontable-pro/src/plugins/filters/filters.js, line 217

addFormula(column, name, args)

Add formula to the formulas collection at specified column index.

Possible predefined formulas:

  • begins_with - Begins with
  • between - Between
  • by_value - By value
  • contains - Contains
  • empty - Empty
  • ends_with - Ends with
  • eq - Equal
  • gt - Greater than
  • gte - Greater than or equal
  • lt - Less than
  • lte - Less than or equal
  • none - None (no filter)
  • not_between - Not between
  • not_contains - Not contains
  • not_empty - Not empty
  • neq - Not equal
Parameters:
Name Type Description
column Number

Column index.

name String

Formula short name.

args Array

Formula arguments.

Example
// Add filter "Greater than" 95 to column at index 1
hot.getPlugin('filters').addFormula(1, 'gt', [95]);
hot.getPlugin('filters').filter();

// Add filter "Begins with" with value "de" and "Not contains" with value "ing"
hot.getPlugin('filters').addFormula(1, 'begins_with', ['de']);
hot.getPlugin('filters').addFormula(1, 'not_contains', ['ing']);
hot.getPlugin('filters').filter();

// If you want to add filter formulas with OR operator you can use formula "by_value"
hot.getPlugin('filters').addFormula(1, 'by_value', [['ing', 'ed', 'as', 'on']]);
hot.getPlugin('filters').filter();
// In this case all value's that don't match will be filtered.
handsontable-pro/src/plugins/filters/filters.js, line 296

clearColumnSelection()

Clear column selection.

handsontable-pro/src/plugins/filters/filters.js, line 236

clearFormulas(column)

Clear all formulas previously added to the collection for the specified column index or, if the column index
was not passed, clear the formulas for all columns.

Parameters:
Name Type Description
column Number optional

Column index.

handsontable-pro/src/plugins/filters/filters.js, line 424

destroy()

Destroy plugin.

handsontable-pro/src/plugins/filters/filters.js, line 164

disablePlugin()

Disable plugin for this Handsontable instance.

handsontable-pro/src/plugins/filters/filters.js, line 99

enablePlugin()

Enable plugin for this Handsontable instance.

handsontable-pro/src/plugins/filters/filters.js, line 247

filter()

Filter data based on added filter formulas.

handsontable-pro/src/plugins/filters/filters.js, line 310

getDataMapAtColumn(column){Array}

Get 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.
handsontable-pro/src/plugins/filters/filters.js, line 289

getSelectedColumn(){Number|null}

Get last selected column index.

Returns: {Number|null}
handsontable-pro/src/plugins/filters/filters.js, line 92

isEnabled(){Boolean}

Check if the plugin is enabled in the Handsontable settings.

Returns: {Boolean}
handsontable-pro/src/plugins/filters/filters.js, line 226

removeFormulas(column)

Remove formulas at specified column index.

Parameters:
Name Type Description
column Number

Column index.