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
asBoolean
(defaulttrue
)rows
asArray
indicators
asBoolean
(defaultfalse
)
Example
const container = document.getElementById('example');
const hot = new Handsontable(container, {
date: 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.
-
hideRow(row)
-
Hides the row provided as row index (counting from 0).
Parameters:
Name Type Description row
Number repeatable Row index.
-
hideRows(rows)
-
Hides the rows provided in the array.
Parameters:
Name Type Description rows
Array.<Number> Array of row index.
-
isEnabled(){Boolean}
-
Checks if the plugin is enabled in the handsontable settings. This method is executed in
Hooks#beforeInit
hook and if it returnstrue
than theHiddenRows#enablePlugin
method is called.Returns: {Boolean}
-
isHidden(row, isLogicIndex){Boolean}
-
Checks if given row is hidden.
Parameters:
Name Type Default Description row
Number Column index.
isLogicIndex
Boolean false flag which determines type of index.
Returns: {Boolean}
-
showRow(row)
-
Shows the row provided as row index (counting from 0).
Parameters:
Name Type Description row
Number repeatable Row index.
-
showRows(rows)
-
Shows the rows provided in the array.
Parameters:
Name Type Description rows
Array.<Number> Array of row index.
-
updatePlugin()
-
Updates the plugin state. This method is executed when
Core#updateSettings
is invoked.