StretchColumns
Plugin: StretchColumns
Description
This plugin allows to set column widths based on their widest cells.
By default, the plugin is declared as 'none', which makes it disabled (same as if it was declared as false).
The plugin determines what happens when the declared grid width is different from the calculated sum of all column widths.
// fit the grid to the container, by stretching only the last columnstretchH: 'last',
// fit the grid to the container, by stretching all columns evenlystretchH: 'all',To configure this plugin see Options#stretchH.
Example
const hotRef = useRef(null);
...
// First, let's construct Handsontable<HotTable ref={hotRef} data={getData()} stretchH={'all'}/>Methods
destroy
stretchColumns.destroy()
Destroys the plugin instance.
disablePlugin
stretchColumns.disablePlugin()
Disables the plugin functionality for this Handsontable instance.
enablePlugin
stretchColumns.enablePlugin()
Enables the plugin functionality for this Handsontable instance.
getColumnWidth
stretchColumns.getColumnWidth(columnVisualIndex) ⇒ number | null
Gets the calculated column width based on the stretching strategy defined by Options#stretchH option.
| Param | Type | Description |
|---|---|---|
| columnVisualIndex | number | The visual index of the column. |
isEnabled
stretchColumns.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 then the #enablePlugin method is called.
updatePlugin
stretchColumns.updatePlugin()
Updates the plugin’s state. This method is executed when Core#updateSettings is invoked.