AutoColumnSize
Description
Initializes the plugin, registers the column widths map, and sets up the column resize hook.
Members
CALCULATION_STEP
AutoColumnSize.CALCULATION_STEP
Returns the number of columns processed in a single calculation step during asynchronous sizing.
DEFAULT_SETTINGS
AutoColumnSize.DEFAULT_SETTINGS
Returns the default settings applied when the plugin is enabled without explicit configuration.
inProgress
autoColumnSize.inProgress : boolean
true if the size calculation is in progress.
measuredColumns
autoColumnSize.measuredColumns : number
Number of already measured columns (we already know their sizes).
PLUGIN_KEY
AutoColumnSize.PLUGIN_KEY
Returns the plugin key used to identify this plugin in Handsontable settings.
PLUGIN_PRIORITY
AutoColumnSize.PLUGIN_PRIORITY
Returns the priority order used to determine the order in which plugins are initialized.
SETTING_KEYS
AutoColumnSize.SETTING_KEYS
Returns true so the plugin updates on every updateSettings call, regardless of config object contents.
SYNC_CALCULATION_LIMIT
AutoColumnSize.SYNC_CALCULATION_LIMIT
Returns the maximum number of columns whose widths are calculated synchronously before switching to async mode.
Methods
calculateAllColumnsWidth
autoColumnSize.calculateAllColumnsWidth(rowRange, [overwriteCache])
Calculates all columns width. The calculated column will be cached in the AutoColumnSize#widths property. To retrieve width for specified column use AutoColumnSize#getColumnWidth method.
| Param | Type | Default | Description |
|---|---|---|---|
| rowRange | object number | Row index or an object with from and to properties which define row range. | |
| [overwriteCache] | boolean | false | optional If true the calculation will be processed regardless of whether the width exists in the cache. |
calculateColumnsWidth
autoColumnSize.calculateColumnsWidth(colRange, rowRange, [overwriteCache])
Calculates a columns width.
| Param | Type | Default | Description |
|---|---|---|---|
| colRange | number object | Visual column index or an object with from and to visual indexes as a range. | |
| rowRange | number object | Visual row index or an object with from and to visual indexes as a range. | |
| [overwriteCache] | boolean | false | optional If true the calculation will be processed regardless of whether the width exists in the cache. |
calculateVisibleColumnsWidth
autoColumnSize.calculateVisibleColumnsWidth()
Calculates widths for visible columns in the viewport only.
clearCache
autoColumnSize.clearCache([physicalColumns])
Clears cache of calculated column widths. If you want to clear only selected columns pass an array with their indexes. Otherwise whole cache will be cleared.
| Param | Type | Description |
|---|---|---|
| [physicalColumns] | Array<number> | optional List of physical column indexes to clear. |
destroy
autoColumnSize.destroy()
Destroys the plugin instance.
disablePlugin
autoColumnSize.disablePlugin()
Disables the plugin functionality for this Handsontable instance.
enablePlugin
autoColumnSize.enablePlugin()
Enables the plugin functionality for this Handsontable instance.
getColumnWidth
autoColumnSize.getColumnWidth(column, [defaultWidth], [keepMinimum]) ⇒ number
Gets the calculated column width.
| Param | Type | Default | Description |
|---|---|---|---|
| column | number | Visual column index. | |
| [defaultWidth] | number | optional Default column width. It will be picked up if no calculated width found. | |
| [keepMinimum] | boolean | true | optional If true then returned value won’t be smaller then 50 (default column width). |
getFirstVisibleColumn
autoColumnSize.getFirstVisibleColumn() ⇒ number
Gets the first visible column.
Returns: number - Returns visual column index, -1 if table is not rendered or if there are no columns to base the the calculations on.
getLastVisibleColumn
autoColumnSize.getLastVisibleColumn() ⇒ number
Gets the last visible column.
Returns: number - Returns visual column index or -1 if table is not rendered.
getSyncCalculationLimit
autoColumnSize.getSyncCalculationLimit() ⇒ number
Gets value which tells how many columns should be calculated synchronously (rest of the columns will be calculated
asynchronously). The limit is calculated based on syncLimit set to autoColumnSize option (see Options#autoColumnSize).
isEnabled
autoColumnSize.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.
isNeedRecalculate
autoColumnSize.isNeedRecalculate() ⇒ boolean
Checks if all widths were calculated. If not then return true (need recalculate).
recalculateAllColumnsWidth
autoColumnSize.recalculateAllColumnsWidth()
Recalculates all columns width (overwrite cache values).
updatePlugin
autoColumnSize.updatePlugin()
Updates the plugin’s state. This method is executed when Core#updateSettings is invoked.