TableView

class pyto_ui.TableView(style: TableViewStyle = TableViewStyle.INSET_GROUPED, sections: list[TableViewSection] = [])

A view containing a list of cells.

A Table View has a list of TableViewSection objects that represent groups of cells. A Table View has two possible styles. See Table View Style.

deselect_row()

Deselects the current selected row.

property did_delete_cell: callable

A function called when a cell contained in the table view is deleted. Takes the section and the selected deleted cell’s index as parameters. This function should be used to remove the data corresponding to the cell from the database.

Return type:

callable

property did_move_cell: callable

A function called when a cell contained in the table view is moved. Takes the section, the moved deleted cell’s index and the destination index as parameters. This function should be used to move the data corresponding to the cell from the database.

Return type:

callable

property did_select_cell: callable

A function called when a cell contained in the table view is selected. Takes the section and the selected cell’s index as parameters.

Return type:

callable

property did_tap_cell_accessory_button: callable

A function called when the accessory button of a cell contained in the table view is pressed. Takes the section and the cell’s index as parameters.

Return type:

callable

property edit_button_item: ButtonItem

Returns a bar button item that toggles its title and associated state between Edit and Done. The button item is setup to edit the Table View.

Return type:

ButtonItem

property reload_action: callable

A function called when the button item is pressed. Takes the button item as parameter.

Return type:

callable

property sections: list[TableViewSection]

A list of TableViewSection containg cells to be displayed on the Table View. Setting a new value will reload automatically the contents of the Table View.

Return type:

list[TableViewSection]

set_cells(cells: list[TableViewCell] | tuple[TableViewCell] | TableViewCell)

Fills the Table View with the given cells.

Parameters:

cells – The cells to display.