scroller.measure()
Recalculate the cached measurements that Scroller uses.
Please note - this property requires the Scroller extension for DataTables.
Description
This method will cause Scroller to take the measurements for the elements it depends upon and recalculate its display values based on the newly read values. The measurements required include the scrolling viewport height and the height of the rows in the table.
This can be particularly useful if the table is initially drawn in a hidden element - for example in a tab.
Type
function scroller.measure( [ redraw ] )
- Description:
Recalculate the measurements that Scroller uses for its virtual display calculations
- Parameters:
Name Type Optional 1 redraw
Yes - default:true Flag to indicate if the table should immediately redraw or not.
true
will redraw the table,false
will not.- Returns:
DataTables API instance for chaining
Example
Perform Scroller measurements when the table was hidden in a Bootstrap tab:
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
DataTable.tables({ visible: true, api: true }).scroller.measure();
});