Datatables - Fixed Header

Basic initialization

The FixedHeader extension will ensure that your column titles will scroll with the page, showing at the top of the table at all times. Note also that the column titles remain clickable to perform ordering on the table. FixedHeader is initialised by using the fixedHeader option. This can be set to true to use the default options or given as an object for additional options. In this example we just use the defaults.

Header and footer fixed

When displaying tables with a particularly large amount of data shown on each page, it can be useful to have the table's header and footer fixed to the top or bottom of the scrolling window FixedHeader provides the ability to fix in place both. These are controlled by the options fixedHeader.header and fixedHeader.footer. Either can be optionally enabled, or as is the case in this example, both enabled.

Header offset

It is not uncommon to have a fixed element at the top or bottom of a web-page to act as a quick access menu to your end users. If you do employ this on the same page as FixedHeader, the software needs to be told to offset the fixed positioning of the header/footer using the fixedHeader.headerOffset and fixedHeader.footerOffset options. Toggle switcher to add/remove fixed navbar and fixed header offset.

ColReorder integration

ColReorder adds the ability for the end user to be able to reorder columns in a DataTable through a click and drag operation. This can be useful when presenting data in a table, letting the user move columns that they wish to compare next to each other for easier comparison. FixedHeader requires no special initialisation when operating with ColReorder - simply initialise both on the table.