fixedHeader.headerOffset()
Get / set the fixed header's offset.
Please note - this property requires the FixedHeader extension for DataTables.
Description
This method provides the ability to control the offset of the fixed header. This offset can be useful if you have an element floating at the top of a page (a navigation menu for example) and you wish to have the header stick to the bottom of that element rather than to the top of the page.
This method, and its counterpart control for the footer, fixedHeader.footerOffset()
, can be useful for cases where that offset can change dynamically (a fixed element that grows on mouse over for example).
Please be aware that the header's position will immediately update once this method has been executed, if required by the page's scrolling position. No other update method is required.
Types
function fixedHeader.headerOffset()
- Description:
Get the fixed header's offset.
- Returns:
The current header offset
function fixedHeader.headerOffset( offset )
- Description:
Set the fixed header's offset
- Returns:
The DataTables API for chaining
Example
Set the header's offset:
var table = new DataTable('#myTable');
table.fixedHeader.headerOffset(10);
Related
The following options are directly related and may also be useful in your application development.