Class: HiddenColumns

HiddenColumns

Plugin allows to hide certain columns. The hiding is achieved by rendering the columns with width 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)
  • columns as Array
  • indicators as Boolean (default false)
Example
const container = document.getElementById('example');
const hot = new Handsontable(container, {
  date: getData(),
  hiddenColumns: {
    copyPasteEnabled: true,
    indicators: true,
    columns: [1, 2, 5]
  }
});

// access to hiddenRows plugin instance:
const hiddenColumnsPlugin = hot.getPlugin('hiddenColumns');

// show single row
hiddenColumnsPlugin.showColumn(1);

// show multiple rows
hiddenColumnsPlugin.showColumn(1, 2, 9);

// or as an array
hiddenColumnsPlugin.showColumns([1, 2, 9]);

// hide single row
hiddenColumnsPlugin.hideColumn(1);

// hide multiple rows
hiddenColumnsPlugin.hideColumn(1, 2, 9);

// or as an array
hiddenColumnsPlugin.hideColumns([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.

hideColumn(column)

Hides a single column.

Parameters:
Name Type Description
column Number repeatable

Column index.

hideColumns(columns)

Hides the columns provided in the array.

Parameters:
Name Type Description
columns Array.<Number>

Array of column 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 HiddenColumns#enablePlugin method is called.

Returns: {Boolean}

isHidden(column, isLogicIndex){Boolean}

Checks if the provided column is hidden.

Parameters:
Name Type Default Description
column Number

Column index.

isLogicIndex Boolean false

flag which determines type of index.

Returns: {Boolean}

showColumn(column)

Shows a single column.

Parameters:
Name Type Description
column Number repeatable

Column index.

showColumns(columns)

Shows the provided columns.

Parameters:
Name Type Description
columns Array.<Number>

Array of column indexes.

updatePlugin()

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