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 physical 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 220

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

Visual 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 310

clearColumnSelection()

Clear column selection.

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

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

Visual column index.

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

destroy()

Destroy plugin.

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

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 256

filter()

Filter data based on added filter formulas.

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

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 303

getSelectedColumn(){Object|null}

Get last selected column index.

Returns: {Object|null} Return null when column isn't selected otherwise
object containing information about selected column with keys visualIndex and physicalIndex
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 467

onComponentChange(component, command)

On component change listener.

Parameters:
Name Type Description
component BaseComponent

Component inheriting BaseComponent

command Object

Menu item object (command).

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

removeFormulas(column)

Remove formulas at specified column index.

Parameters:
Name Type Description
column Number

Visual column index.