Tutorial: Hiding rows

Hiding rows


Overview

The Hidden Rows plugin allows hiding specific rows from the table. (Note, that these rows are still being rendered - the plugin just hides them using CSS).

Quick setup

The hiddenRows parameter accepts an object. To provide the rows to hide, you need to specify the rows property for the object - it should be defined as an array of numbers, which represents the indexes of rows that need to be hidden.

See the examples section for more details.

Additional options

The plugin allows displaying hidden row indicators in the headers, to notify the user which rows have been hidden.
To enable them, set the indicators property in the plugin's configuration object to true.

See the examples section for more details.

You can change the selection area of copy/paste range by setting copyPasteEnabled property to true or false. By default this property is set to true. If set to false, then hidden rows are being skipped for copy/paste actions.

You can show/hide certain rows straight from the Context menu using the following keys: hidden_rows_show and hidden_rows_hide. A current bottleneck is that this plugin doesn't work properly with column sorting and filters.

See the examples section for more details.

Example

API examples

You can access the plugin instance by calling

var plugin = hot.getPlugin('hiddenRows');

To hide a single row, call the hideRow method of the plugin object:

plugin.hideRow(4);

To trim multiple rows, you can either pass them as arguments to the hideRow method, or pass an array of indexes to the hideRows method:

plugin.hideRow(0, 4, 6);
// or
plugin.hideRows([0, 4, 6]);

To restore the trimmed row(s), use the following methods:

plugin.showRow(4);

plugin.showRow(0, 4, 6);

plugin.showRows([0, 4, 6]);

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

Help us improve this page