Layout

Layout#

By default, datatables that don’t fit in one page come with a search box, a pagination control, a table summary, etc. You can select which elements are actually displayed using DataTables’ layout option with e.g.:

import itables

itables.init_notebook_mode()
df = itables.sample_dfs.get_countries()
itables.show(df, layout={"topStart": "search", "topEnd": None})
region country capital longitude latitude
code
AWLatin America & Caribbean ArubaOranjestad-70.01670012.516700
AFSouth AsiaAfghanistanKabul69.17610034.522800
AOSub-Saharan Africa AngolaLuanda13.242000-8.811550
ALEurope & Central AsiaAlbaniaTirane19.81720041.331700
ADEurope & Central AsiaAndorraAndorra la Vella1.52180042.507500
AEMiddle East & North AfricaUnited Arab EmiratesAbu Dhabi54.37050024.476400
ARLatin America & Caribbean ArgentinaBuenos Aires-58.417300-34.611800
AMEurope & Central AsiaArmeniaYerevan44.50900040.159600
ASEast Asia & PacificAmerican SamoaPago Pago-170.691000-14.284600
AGLatin America & Caribbean Antigua and BarbudaSaint John's-61.84560017.117500
(198 more rows not shown)

The available positions are topStart, topEnd, bottomStart, bottomEnd. You can also use top2Start, etc… (see more in the DataTables documentation).

Like for the other arguments of show, you can change the default value of the dom option with e.g.:

itables.options.layout =  {
    "topStart": "pageLength",
    "topEnd": "search",
    "bottomStart": "info",
    "bottomEnd": "paging"
}  # (default value)

Tip

The layout option was introduced with itables==2.0 and DataTables==2.0 and replaced the former dom option.