FixedHeader

FixedHeader#

FixedHeader is a DataTables extension that keeps the table header visible while scrolling.

Use fixedHeader=True to enable a fixed table header:

import itables

itables.init_notebook_mode()

df = itables.sample_dfs.get_countries()

itables.show(
    df,
    # fixedHeader=True is simpler,
    # but in some contexts, like here in Jupyter Book,
    # we need to account for the other fixed elements
    fixedHeader={"header": True, "headerOffset": 48},
)
Loading ITables v2.7.1.dev from the init_notebook_mode cell... (need help?)

You can also configure header and footer behavior explicitly, as in the header/footer example:

itables.show(
    df,
    footer=True,
    fixedHeader={"header": True, "footer": True},
)
Loading ITables v2.7.1.dev from the init_notebook_mode cell... (need help?)

As always, you can set this option globally with:

itables.options.fixedHeader = True

or by adding

fixedHeader = true

to your itables.toml configuration file.