Select

Select#

The select extension let you select rows (or cells).

The selected_rows attribute

It is possible to access the selected_rows back in Python but for this you will have to use, instead of show, either

⚠ When a table has been downsampled, only the visible rows can be selected.

Tip

The select option also interacts with the buttons extension. If you click on the CSV or Excel export while having selected some rows, only those rows will be exported - see the example below.

import itables

itables.init_notebook_mode()

itables.show(
    itables.sample_dfs.get_countries(html=False),
    select=True,
    selected_rows=[2, 4, 5],
    buttons=["copyHtml5", "csvHtml5", "excelHtml5"],
)
Loading ITables v2.4.0rc1 from the init_notebook_mode cell... (need help?)

Tip

The select option accept multiple values, as documented here:

  • select=True or select="os" let you select using single click, shift-click and ctrl-click

  • select="single" let you select a single row

  • select="multi" for single click selection of multiple rows, select="multi+shift", …

With select={"style": "os", "items": "cell"} you can let the user select specific cells, however the cell selection is not exposed in Python, nor taken into account when exporting the data.