Skip to content

DataTable2

DataTable2 #

Bases: DataTable

Extends DataTable.

Provides sticky header row, scrollable data rows, and additional layout flexibility with DataColumn2 and DataRow2.

bottom_margin: ft.Number | None = None #

Adds space after the last row if set.

checkbox_alignment: ft.Alignment = field(default_factory=lambda: ft.Alignment.center()) #

Alignment of the checkbox.

columns: list[DataColumn2 | ft.DataColumn] #

A list of table columns.

data_row_checkbox_theme: ft.CheckboxTheme | None = None #

Overrides theme of checkboxes in each data row.

data_row_height: ft.Number | None = None #

Height of each data row.

Note

DataTable2 doesn't support DataTable.data_row_min_height and DataTable.data_row_max_height.

empty: ft.Control | None = None #

Placeholder control shown when there are no data rows.

fixed_columns_color: ft.ColorValue | None = None #

Background color for sticky left columns.

fixed_corner_color: ft.ColorValue | None = None #

Background color of the fixed top-left corner cell.

fixed_left_columns: int = 0 #

Number of sticky columns on the left. Includes checkbox column, if present.

fixed_top_rows: int = 1 #

Number of sticky rows from the top. Includes heading row by default.

heading_checkbox_theme: ft.CheckboxTheme | None = None #

Overrides theme of the heading checkbox.

lm_ratio: ft.Number = 1.2 #

Ratio of Large column width to Medium.

min_width: ft.Number | None = None #

Minimum table width before horizontal scrolling kicks in.

rows: list[ft.DataRow | DataRow2] = field(default_factory=list) #

A list of table rows.

show_heading_checkbox: bool = True #

Controls visibility of the heading checkbox.

sm_ratio: ft.Number = 0.67 #

Ratio of Small column width to Medium.

sort_arrow_animation_duration: ft.DurationValue = field(default_factory=lambda: ft.Duration(milliseconds=150)) #

Duration of sort arrow animation.

sort_arrow_icon: ft.IconValue = ft.Icons.ARROW_UPWARD #

Icon shown when sorting is applied.

sort_arrow_icon_color: ft.ColorValue | None = None #

When set always overrides/preceeds default arrow icon color.

visible_horizontal_scroll_bar: bool | None = None #

Determines visibility of the horizontal scrollbar.

visible_vertical_scroll_bar: bool | None = None #

Determines visibility of the vertical scrollbar.