Class: AutoRowSize

AutoRowSize

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

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%'},
...

You can also use the allowSampleDuplicates option to allow sampling duplicate values when calculating the row height. Note, that this might have
a negative impact on performance.

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 199

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 165

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 363

clearCache()

Clear cached heights.

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

clearCacheByRange(range)

Clear cache by range.

Parameters:
Name Type Description
range Object | Number

Row range object.

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

destroy()

Destroy plugin instance.

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

disablePlugin()

Disable plugin for this Handsontable instance.

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

enablePlugin()

Enable plugin for this Handsontable instance.

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

getColumnHeaderHeight(){Number|undefined}

Get the calculated column header height.

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

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 347

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 305

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 280

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 125

isEnabled(){Boolean}

Check if the plugin is enabled in the Handsontable settings.

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

isNeedRecalculate(){Boolean}

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

recalculateAllRowsHeight()

Recalculate all rows height (overwrite cache values).