This page covers a next version of Handsontable, and is not published yet.

This page covers a non-latest version of Handsontable.

# Column hiding

# Overview

The Hidden Columns plugin allows hiding specific columns from the table.

# Quick setup

The hiddenColumns parameter accepts an object. The columns property needs to be specified for the object to hide specific columns. It should be defined as an array of numbers representing the indexes of columns that need to be hidden.

# Additional options

The plugin has a feature that enables hidden column indicators to be displayed in the headers to notify the user which columns have been hidden. Set the indicators property in the plugin's configuration object to true to enable them.


Important note: The colHeaders option needs to be enabled when using both nestedHeaders and hiddenColumns together with indicators. Otherwise, the indicators will not appear.

To change the selection area of the copy/paste range, set the copyPasteEnabled property to true or false. By default, this property is set to true. If set to false, the hidden columns are skipped for copy/paste actions.

To show/hide certain columns directly from the Context menu use the following keys: hidden_columns_show and hidden_columns_hide.

# Example

    To access the plugin instance, call the getPlugin method:

    const plugin = hot.getPlugin('hiddenColumns');

    To hide a single column, call the hideColumn method of the plugin object:


    To hide multiple columns, either pass them as arguments to the hideColumn method, or pass an array of indexes to the hideColumns method:

    plugin.hideColumn(0, 4, 6);
    // or
    plugin.hideColumns([0, 4, 6]);

    To restore the hidden column(s), use the following methods:

    plugin.showColumn(0, 4, 6);
    plugin.showColumns([0, 4, 6]);

    To see the changes made, call hot.render(); to re-render the table.