HiddenRows

Plugin allows to hide certain rows. The hiding is achieved by rendering the rows with height set as 0px.
The plugin not modifies the source data and do not participate in data transformation (the shape of data returned
by getData* methods stays intact).

Possible plugin settings:

  • copyPasteEnabled as Boolean (default true)
  • rows as Array
  • indicators as Boolean (default false).
Example
const container = document.getElementById('example');
const hot = new Handsontable(container, {
  data: getData(),
  hiddenRows: {
    copyPasteEnabled: true,
    indicators: true,
    rows: [1, 2, 5]
  }
});

// access to hiddenRows plugin instance
const hiddenRowsPlugin = hot.getPlugin('hiddenRows');

// show single row
hiddenRowsPlugin.showRow(1);

// show multiple rows
hiddenRowsPlugin.showRow(1, 2, 9);

// or as an array
hiddenRowsPlugin.showRows([1, 2, 9]);

// hide single row
hiddenRowsPlugin.hideRow(1);

// hide multiple rows
hiddenRowsPlugin.hideRow(1, 2, 9);

// or as an array
hiddenRowsPlugin.hideRows([1, 2, 9]);

// rerender the table to see all changes
hot.render();

Methods

destroy()

Destroys the plugin instance.

disablePlugin()

Disables the plugin functionality for this Handsontable instance.

enablePlugin()

Enables the plugin functionality for this Handsontable instance.

getHiddenRows(){Array.<number>}

Returns an array of visual indexes of hidden rows.

Returns: {Array.<number>}

hideRow(row)

Hides the row provided as row index (counting from 0).

Parameters:
Name Type Description
row number repeatable

Visual row index.

hideRows(rows)

Hides the rows provided in the array.

Parameters:
Name Type Description
rows Array.<number>

Array of visual row indexes.

isEnabled(){boolean}

Checks if the plugin is enabled in the handsontable settings. This method is executed in Hooks#beforeInit
hook and if it returns true than the HiddenRows#enablePlugin method is called.

Returns: {boolean}

isHidden(row){boolean}

Checks if the provided row is hidden.

Parameters:
Name Type Description
row number

Visual row index.

Returns: {boolean}

isValidConfig(hiddenRows){boolean}

Checks whether all of the provided row indexes are within the bounds of the table.

Parameters:
Name Type Description
hiddenRows Array

List of hidden visual row indexes.

Returns: {boolean}

showRow(row)

Shows the row provided as row index (counting from 0).

Parameters:
Name Type Description
row number repeatable

Visual row index.

showRows(rows)

Shows the rows provided in the array.

Parameters:
Name Type Description
rows Array.<number>

Array of visual row indexes.

updatePlugin()

Updates the plugin state. This method is executed when Core#updateSettings is invoked.

Class: HiddenRows