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
asBoolean
(defaulttrue
)columns
asArray
indicators
asBoolean
(defaultfalse
)
Example
const container = document.getElementById('example');
const hot = new Handsontable(container, {
date: getData(),
hiddenColumns: {
copyPasteEnabled: true,
indicators: true,
columns: [1, 2, 5]
}
});
// access to hiddenColumns plugin instance:
const hiddenColumnsPlugin = hot.getPlugin('hiddenColumns');
// show single row
hiddenColumnsPlugin.showColumn(1);
// show multiple columns
hiddenColumnsPlugin.showColumn(1, 2, 9);
// or as an array
hiddenColumnsPlugin.showColumns([1, 2, 9]);
// hide single row
hiddenColumnsPlugin.hideColumn(1);
// hide multiple columns
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 Visual column index.
-
hideColumns(columns)
-
Hides the columns provided in the array.
Parameters:
Name Type Description columns
Array.<Number> Array of visual column indexes.
-
isColumnDataValid(columns)
-
Check whether all of the provided column indexes are within the bounds of the table.
Parameters:
Name Type Description columns
Array 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 returnstrue
than theHiddenColumns#enablePlugin
method is called.Returns: {Boolean}
-
isHidden(column, isPhysicalIndex){Boolean}
-
Checks if the provided column is hidden.
Parameters:
Name Type Default Description column
Number Column index.
isPhysicalIndex
Boolean false flag which determines type of index.
Returns: {Boolean}
-
showColumn(column)
-
Shows a single column.
Parameters:
Name Type Description column
Number repeatable Visual 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.