DataColumn
Column configuration for a DataTable.
Inherits: Control
Properties
heading_row_alignment- Defines the horizontal layout of the label and sort indicator in the heading row.label- The column heading.numeric- Whether this column represents numeric data or not.size- The share of the table width this column gets, relative to other columns.tooltip- The column heading's tooltip.width- The fixed width of this column, in virtual pixels, including its cell padding.
Events
on_sort- Called when the user asks to sort the table using this column.
Properties
heading_row_alignmentclass-attributeinstance-attribute
heading_row_alignment: MainAxisAlignment | None = NoneDefines the horizontal layout of the label and sort indicator in the heading row.
labelinstance-attribute
label: StrOrControlThe column heading.
Typically, this will be a Text control.
It could also be an Icon (typically using size 18),
or a combination of both in a Row.
Raises:
- ValueError - If it is neither a string nor a visible
Control.
numericclass-attributeinstance-attribute
numeric: bool = FalseWhether this column represents numeric data or not.
The contents of cells of columns containing numeric data are right-aligned.
sizeclass-attributeinstance-attribute
size: DataColumnSize | None = NoneThe share of the table width this column gets, relative to other columns.
Ignored when width is set. Defaults to
DataColumnSize.S.
Used only in scrolling mode, when DataTable.scroll is set.
tooltipclass-attributeinstance-attribute
tooltip: str | None = field(default=None, kw_only=True)The column heading's tooltip.
This is a longer description of the column heading, for cases where the heading might have been abbreviated to keep the column width to a reasonable size.
widthclass-attributeinstance-attribute
width: Number | None = NoneThe fixed width of this column, in virtual pixels, including its cell padding.
If not set, a table in the default mode sizes the column to its widest cell, and
a scrolling table (with DataTable.scroll set) gives the
column a share of its width by size.
Raises:
- ValueError - If it is negative.
Events
on_sortclass-attributeinstance-attribute
on_sort: EventHandler[DataColumnSortEvent] | None = NoneCalled when the user asks to sort the table using this column.
If not set, the column will not be considered sortable.