DataRow
Row configuration and cell data for a DataTable.
One row configuration must be provided for each row to display in the table.
The data for this row of the table is provided in the cells property.
Inherits: Control
Properties
Events
on_double_tap- Called when the row is double-tapped.on_long_press- Called when this row is long-pressed.on_secondary_tap- Called when the row is tapped with a secondary button, such as a right-click.on_secondary_tap_down- Called when a secondary button, such as the right mouse button, goes down on the row, with the position of the pointer.on_select_change- Called when the user selects or unselects a selectable row.on_tap- Called when the row is tapped.
Properties
cellsclass-attributeinstance-attribute
cells: list[DataCell] = field(default_factory=list)The data for this row: a list of DataCell controls.
There must be exactly as many cells as there are visible
DataTable.columns in the table.
Raises:
- ValueError - If it does not contain at least one visible
DataCell.
colorclass-attributeinstance-attribute
color: ControlStateValue[ColorValue] | None = NoneThe color of this row.
By default, the color is transparent unless selected. Selected rows has a grey translucent color.
The effective color can depend on the ControlState
state, if the row is selected, pressed, hovered, focused, disabled or enabled. The
color is painted as an overlay to the row. To make sure that the row's InkWell is
visible (when pressed, hovered and focused), it is recommended to use a translucent
color.
decorationclass-attributeinstance-attribute
decoration: BoxDecoration | None = NoneThe decoration painted behind this row.
If set, DataTable.divider_thickness has no effect on this row.
Used only in scrolling mode, when DataTable.scroll is set.
heightclass-attributeinstance-attribute
height: Number | None = NoneThe height of this row, in virtual pixels.
If not set, the row is DataTable.data_row_min_height high.
Raises:
- ValueError - If it is negative.
Used only in scrolling mode, when DataTable.scroll is set.
selectedclass-attributeinstance-attribute
selected: bool = FalseWhether the row is selected.
If on_select_change is non-null for any row in the table, then a checkbox is
shown at the start of each row. If the row is selected (True), the checkbox will
be checked and the row will be highlighted.
Otherwise, the checkbox, if present, will not be checked.
Events
on_double_tapclass-attributeinstance-attribute
on_double_tap: ControlEventHandler[DataRow] | None = NoneCalled when the row is double-tapped.
Not called for a tap on a cell with a tap handler of its own.
Used only in scrolling mode, when DataTable.scroll is set.
on_long_pressclass-attributeinstance-attribute
on_long_press: ControlEventHandler[DataRow] | None = NoneCalled when this row is long-pressed.
If a DataCell in the row has its DataCell.on_tap,
DataCell.on_double_tap, DataCell.on_long_press,
DataCell.on_tap_cancel or DataCell.on_tap_down
callback defined, that callback behavior overrides the gesture behavior of the row
for that particular cell.
on_secondary_tapclass-attributeinstance-attribute
on_secondary_tap: ControlEventHandler[DataRow] | None = NoneCalled when the row is tapped with a secondary button, such as a right-click.
Not called for a tap on a cell with a tap handler of its own.
Used only in scrolling mode, when DataTable.scroll is set.
on_secondary_tap_downclass-attributeinstance-attribute
on_secondary_tap_down: (
EventHandler[TapEvent[DataRow]] | None
) = NoneCalled when a secondary button, such as the right mouse button, goes down on the row, with the position of the pointer.
Not called for a tap on a cell with a tap handler of its own.
Used only in scrolling mode, when DataTable.scroll is set.
on_select_changeclass-attributeinstance-attribute
on_select_change: ControlEventHandler[DataRow] | None = NoneCalled when the user selects or unselects a selectable row.
If this is not null, then this row is selectable. The current selection state of this row is given by selected.
If any row is selectable, then the table's heading row will have a checkbox that can be checked to select all selectable rows (and which is checked if all the rows are selected), and each subsequent row will have a checkbox to toggle just that row.
A row whose on_select_change callback is null is ignored for the purposes of
determining the state of the "all" checkbox, and its checkbox is disabled.
If a DataCell in the row has its DataCell.on_tap
callback defined, that callback behavior overrides the gesture behavior of the
row for that particular cell.
on_tapclass-attributeinstance-attribute
on_tap: ControlEventHandler[DataRow] | None = NoneCalled when the row is tapped.
Not called for a tap on a cell with a tap handler of its own
(on_tap, on_double_tap,
on_long_press, on_tap_cancel
or on_tap_down).
Used only in scrolling mode, when DataTable.scroll is set.