Skip to content

datatable ¤

Data tables with selectable rows.

Classes:

Checkbox dataclass ¤

Checkbox(checked: bool = False)

A checkbox, added to rows to make them selectable.

Methods:

  • check

    Uncheck the checkbox.

  • toggle

    Toggle the checkbox.

  • uncheck

    Uncheck the checkbox.

check ¤

check() -> None

Uncheck the checkbox.

toggle ¤

toggle() -> bool

Toggle the checkbox.

uncheck ¤

uncheck() -> None

Uncheck the checkbox.

SelectableRow dataclass ¤

SelectableRow(table: SelectableRowsDataTable, key: RowKey)

A selectable row.

Methods:

Attributes:

app property ¤

app: App

Textual application.

checkbox property ¤

checkbox: Checkbox

Row checkbox.

data property ¤

data: list

Row data (without checkbox).

index property ¤

index: int

Row index.

next property ¤

Next row (down).

previous property ¤

previous: SelectableRow

Previous row (up).

selected property ¤

selected: bool

Whether this row is selected.

remove ¤

remove() -> None

Remove row from the table.

select ¤

select() -> None

Select this row.

toggle_select ¤

toggle_select() -> bool

Toggle-select this row.

unselect ¤

unselect() -> None

Unselect this row.

SelectableRowsDataTable ¤

Bases: DataTable

Data table with selectable rows.

Methods:

Attributes:

current_row property ¤

current_row: SelectableRow

Currently selected row.

selectable_rows property ¤

selectable_rows: Iterator[SelectableRow]

Rows, as selectable ones.

selected_rows property ¤

selected_rows: Iterator[SelectableRow]

Selected rows.

action_reverse_select ¤

action_reverse_select() -> None

Reverse selection.

action_toggle_select_all ¤

action_toggle_select_all() -> None

Toggle-select all rows.

action_toggle_select_down ¤

action_toggle_select_down() -> None

Toggle selection down.

action_toggle_select_row ¤

action_toggle_select_row() -> None

Toggle-select current row.

action_toggle_select_up ¤

action_toggle_select_up() -> None

Toggle selection up.

add_rows ¤

add_rows(rows: Iterable[Iterable]) -> list[RowKey]

Add rows.

Automatically insert a column with checkboxes in position 0.

clear ¤

clear(columns: bool = True) -> SelectableRowsDataTable

Clear rows and optionally columns.

When clearing columns, automatically re-add a column for checkboxes.

force_refresh ¤

force_refresh() -> None

Force refresh table.