Class: AutoRowSize

AutoRowSize

handsontable/src/plugins/autoRowSize/autoRowSize.js, line 61

This plugin allows to set row heights based on their highest cells.

By default, the plugin is declared as undefined, which makes it disabled (same as if it was declared as false).
Enabling this plugin may decrease the overall table performance, as it needs to calculate the heights of all cells to
resize the rows accordingly.
If you experience problems with the performance, try turning this feature off and declaring the row heights manually.

Row height calculations are divided into sync and async part. Each of this parts has their own advantages and
disadvantages. Synchronous calculations are faster but they block the browser UI, while the slower asynchronous operations don't
block the browser UI.

To configure the sync/async distribution, you can pass an absolute value (number of columns) or a percentage value to a config object:

...
// as a number (300 columns in sync, rest async)
autoRowSize: {syncLimit: 300},
...

...
// as a string (percent)
autoRowSize: {syncLimit: '40%'},
...

To configure this plugin see Options#autoRowSize.

Example
...
var hot = new Handsontable(document.getElementById('example'), {
  date: getData(),
  autoRowSize: true
});
// Access to plugin instance:
var plugin = hot.getPlugin('autoRowSize');

plugin.getRowHeight(4);

if (plugin.isEnabled()) {
  // code...
}
...

Members

firstCalculationBoolean

true if only the first calculation was performed.

ghostTableGhostTable

Instance of GhostTable for rows and columns size calculations.

heightsArray

Cached rows heights.

inProgressBoolean

true if the size calculation is in progress.

samplesGeneratorSamplesGenerator

Instance of SamplesGenerator for generating samples necessary for rows height calculations.

Methods

handsontable/src/plugins/autoRowSize/autoRowSize.js, line 201

calculateAllRowsHeight(colRange)

Calculate the height of all the rows.

Parameters:
Name Type Description
colRange Object | Number

Column range object.

handsontable/src/plugins/autoRowSize/autoRowSize.js, line 167

calculateRowsHeight(rowRange, colRange, force)

Calculate a given rows height.

Parameters:
Name Type Default Description
rowRange Number | Object

Row range object.

colRange Number | Object

Column range object.

force Boolean false optional

If true force calculate height even when value was cached earlier.

handsontable/src/plugins/autoRowSize/autoRowSize.js, line 345

clearCache()

Clear cached heights.

handsontable/src/plugins/autoRowSize/autoRowSize.js, line 355

clearCacheByRange(range)

Clear cache by range.

Parameters:
Name Type Description
range Object | Number

Row range object.

handsontable/src/plugins/autoRowSize/autoRowSize.js, line 464

destroy()

Destroy plugin instance.

handsontable/src/plugins/autoRowSize/autoRowSize.js, line 156

disablePlugin()

Disable plugin for this Handsontable instance.

handsontable/src/plugins/autoRowSize/autoRowSize.js, line 129

enablePlugin()

Enable plugin for this Handsontable instance.

handsontable/src/plugins/autoRowSize/autoRowSize.js, line 302

getColumnHeaderHeight(){Number|undefined}

Get the calculated column header height.

Returns: {Number|undefined}
handsontable/src/plugins/autoRowSize/autoRowSize.js, line 311

getFirstVisibleRow(){Number}

Get the first visible row.

Returns: {Number} Returns row index or -1 if table is not rendered.
handsontable/src/plugins/autoRowSize/autoRowSize.js, line 329

getLastVisibleRow(){Number}

Get the last visible row.

Returns: {Number} Returns row index or -1 if table is not rendered.
handsontable/src/plugins/autoRowSize/autoRowSize.js, line 287

getRowHeight(row, defaultHeight){Number}

Get the calculated row height.

Parameters:
Name Type Description
row Number

Row index.

defaultHeight Number optional

Default row height. It will be pick up if no calculated height found.

Returns: {Number}
handsontable/src/plugins/autoRowSize/autoRowSize.js, line 262

getSyncCalculationLimit(){Number}

Get value which tells how much rows will be calculated synchronously. Rest rows will be calculated asynchronously.

Returns: {Number}
handsontable/src/plugins/autoRowSize/autoRowSize.js, line 122

isEnabled(){Boolean}

Check if the plugin is enabled in the Handsontable settings.

Returns: {Boolean}
handsontable/src/plugins/autoRowSize/autoRowSize.js, line 365

isNeedRecalculate(){Boolean}

Returns: {Boolean}
handsontable/src/plugins/autoRowSize/autoRowSize.js, line 250

recalculateAllRowsHeight()

Recalculate all rows height (overwrite cache values).