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})
Loading ITables v2.9.0 from the init_notebook_mode cell...
(need help?)
|
| ⓘ | region | country | capital | longitude | latitude |
|---|---|---|---|---|---|
| code | |||||
| AW | Latin America & Caribbean | Aruba | Oranjestad | -70.016700 | 12.516700 |
| AF | South Asia | Afghanistan | Kabul | 69.176100 | 34.522800 |
| AO | Sub-Saharan Africa | Angola | Luanda | 13.242000 | -8.811550 |
| AL | Europe & Central Asia | Albania | Tirane | 19.817200 | 41.331700 |
| AD | Europe & Central Asia | Andorra | Andorra la Vella | 1.521800 | 42.507500 |
| AE | Middle East & North Africa | United Arab Emirates | Abu Dhabi | 54.370500 | 24.476400 |
| AR | Latin America & Caribbean | Argentina | Buenos Aires | -58.417300 | -34.611800 |
| AM | Europe & Central Asia | Armenia | Yerevan | 44.509000 | 40.159600 |
| AS | East Asia & Pacific | American Samoa | Pago Pago | -170.691000 | -14.284600 |
| AG | Latin America & Caribbean | Antigua and Barbuda | Saint John's | -61.845600 | 17.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.