ManualRowResize
Description
Initializes the plugin and creates the resize gesture.
Options
manualRowResize
Can be set at: grid
manualRowResize.manualRowResize : boolean | Array<number>
The manualRowResize option configures the ManualRowResize plugin.
You can set the manualRowResize option to one of the following:
| Setting | Description |
|---|---|
true | Enable the ManualRowResize plugin |
false | Disable the ManualRowResize plugin |
| An array | - Enable the ManualRowResize plugin- Set initial heights of individual rows |
Read more:
This option can only be set at the grid level.
It has no effect when set in the columns, cells, or cell options.
Default: undefined
Example
// enable the `ManualRowResize` pluginmanualRowResize: true,
// enable the `ManualRowResize` plugin// set the initial height of row 0 to 40 pixels// set the initial height of row 1 to 50 pixels// set the initial height of row 2 to 60 pixelsmanualRowResize: [40, 50, 60],Members
PLUGIN_KEY
ManualRowResize.PLUGIN_KEY
Returns the plugin key used to identify this plugin in Handsontable settings.
PLUGIN_PRIORITY
ManualRowResize.PLUGIN_PRIORITY
Returns the priority order used to determine the order in which plugins are initialized.
SETTING_KEYS
ManualRowResize.SETTING_KEYS ⇒ Array<string>
Returns the setting keys that trigger a plugin update after an updateSettings() call. The
rowHeights option is listed alongside the plugin’s own key, so that re-declaring the row
heights discards the heights kept from earlier manual resizing.
Methods
clearManualSize
manualRowResize.clearManualSize(row)
Clears the height stored for the specified row, so the row falls back to the height coming from
the rowHeights option or from the theme. Call render()
afterwards to repaint the grid.
Example
const resizePlugin = hot.getPlugin('manualRowResize');
resizePlugin.clearManualSize(0);hot.render();| Param | Type | Description |
|---|---|---|
| row | number | Visual row index. |
clearManualSizes
manualRowResize.clearManualSizes()
Clears the heights stored for every row, so the rows fall back to the heights coming from the
rowHeights option or from the theme. Call render() afterwards
to repaint the grid.
Example
const resizePlugin = hot.getPlugin('manualRowResize');
resizePlugin.clearManualSizes();hot.render();destroy
manualRowResize.destroy()
Destroys the plugin instance.
disablePlugin
manualRowResize.disablePlugin()
Disables the plugin functionality for this Handsontable instance.
enablePlugin
manualRowResize.enablePlugin()
Enables the plugin functionality for this Handsontable instance.
getLastDesiredRowHeight
manualRowResize.getLastDesiredRowHeight() ⇒ number
Returns the last desired row height set manually with the resize handle.
Returns: number - The last desired row height.
getManualSize
manualRowResize.getManualSize(row) ⇒ number | null
Returns the height set manually for the specified row, or null when the row was never
resized by hand and takes its height from elsewhere.
| Param | Type | Description |
|---|---|---|
| row | number | Visual row index. |
getManualSizes
manualRowResize.getManualSizes() ⇒ Array<Array<number>>
Returns every height set manually, as [physicalRow, height] pairs. Physical indexes,
because the map stores them that way: a manually resized row that trimming has taken out
of the visual space still carries its height here, while getManualSize cannot reach it.
Returns: Array<Array<number>> - The stored [physicalRow, height] pairs.
isEnabled
manualRowResize.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 ManualRowResize#enablePlugin method is called.
loadManualRowHeights Deprecated
manualRowResize.loadManualRowHeights() ⇒ Array
Deprecated. The `PersistentState` plugin has been removed. This method is a no-op.saveManualRowHeights Deprecated
manualRowResize.saveManualRowHeights()
Deprecated. The `PersistentState` plugin has been removed. This method is a no-op.setManualSize
manualRowResize.setManualSize(row, height) ⇒ number
Sets the new height for the specified visual row index.
This method updates the plugin’s internal height map. Call render() after setManualSize() to repaint the grid.
Values lower than the theme’s default row height are saved as the default row height.
Example
const resizePlugin = hot.getPlugin('manualRowResize');
resizePlugin.setManualSize(0, 40);hot.render();| Param | Type | Description |
|---|---|---|
| row | number | Visual row index. |
| height | number | Row height (no less than the theme’s default row height). |
Returns: number - Returns new height.
setManualSizes
manualRowResize.setManualSizes(sizes)
Writes a set of manual heights at once, addressed by physical row index — the counterpart
of ManualRowResize#getManualSizes, so a stored set round-trips onto the same
records regardless of trimming or row order. Values lower than the theme’s default row
height are saved as that height, and an index outside the current row count is skipped.
Call render() afterwards to repaint the grid.
| Param | Type | Description |
|---|---|---|
| sizes | Array<Array<number>> | The [physicalRow, height] pairs to write. |
updatePlugin
manualRowResize.updatePlugin([newSettings])
Updates the plugin’s state.
This method is executed when updateSettings() is invoked with any of the following configuration options:
Passing rowHeights re-declares the row heights, so the heights kept from earlier manual
resizing are discarded. A grid whose manualRowResize option is an array keeps that array
instead, whether the array arrives in this call or was set when the grid was built.
| Param | Type | Description |
|---|---|---|
| [newSettings] | object | optional The config object passed to updateSettings(). |