TrimRows

The plugin allows to trim certain rows. The trimming is achieved by applying the transformation algorithm to the data
transformation. In this case, when the row is trimmed it is not accessible using getData* methods thus the trimmed
data is not visible to other plugins.

Example
const container = document.getElementById('example');
const hot = new Handsontable(container, {
  data: getData(),
  // hide selected rows on table initialization
  trimRows: [1, 2, 5]
});

// access the trimRows plugin instance
const trimRowsPlugin = hot.getPlugin('trimRows');

// hide single row
trimRowsPlugin.trimRow(1);

// hide multiple rows
trimRowsPlugin.trimRow(1, 2, 9);

// or as an array
trimRowsPlugin.trimRows([1, 2, 9]);

// show single row
trimRowsPlugin.untrimRow(1);

// show multiple rows
trimRowsPlugin.untrimRow(1, 2, 9);

// or as an array
trimRowsPlugin.untrimRows([1, 2, 9]);

// rerender table to see the 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.

getTrimmedRows(){Array}

Get list of trimmed rows.

Returns: {Array} Physical rows.

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 AutoRowSize#enablePlugin method is called.

Returns: {boolean}

isTrimmed(physicalRow){boolean}

Checks if given row is hidden.

Parameters:
Name Type Description
physicalRow number

Physical row index.

Returns: {boolean}

isValidConfig(trimmedRows){boolean}

Get if trim config is valid. Check whether all of the provided row indexes are within source data.

Parameters:
Name Type Description
trimmedRows Array

List of physical row indexes.

Returns: {boolean}

trimRow(row)

Trims the row provided as physical row index (counting from 0).

Parameters:
Name Type Description
row number repeatable

Physical row index.

trimRows(rows)

Trims the rows provided in the array.

Parameters:
Name Type Description
rows Array.<number>

Array of physical row indexes.

Fires:

untrimAll()

Untrims all trimmed rows.

untrimRow(row)

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

Parameters:
Name Type Description
row number repeatable

Physical row index.

untrimRows(rows)

Untrims the rows provided in the array.

Parameters:
Name Type Description
rows Array.<number>

Array of physical row indexes.

Fires:

updatePlugin()

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

Class: TrimRows