Skip to content
This repository was archived by the owner on Dec 24, 2025. It is now read-only.

Commit 783940d

Browse files
committed
mkdocs
1 parent ae99b81 commit 783940d

4 files changed

Lines changed: 30 additions & 24 deletions

File tree

examples/datatable2_example/src/main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import flet as ft
44
from data import desserts
55

6-
from flet_datatable2 import DataColumn2, DataRow2, DataTable2, Size
6+
from flet_datatable2 import DataColumn2, DataRow2, DataTable2, DataColumnSize
77

88
logging.basicConfig(level=logging.DEBUG)
99

@@ -31,7 +31,7 @@ def get_data_columns():
3131
data_columns = [
3232
DataColumn2(
3333
ft.Text("Name"),
34-
size=Size.L,
34+
size=DataColumnSize.L,
3535
on_sort=sort_column,
3636
heading_row_alignment=ft.MainAxisAlignment.START,
3737
),
@@ -80,7 +80,7 @@ def get_data_rows(desserts):
8080
data_rows.append(
8181
DataRow2(
8282
specific_row_height=50,
83-
on_select_changed=select_row,
83+
on_select_change=select_row,
8484
cells=[
8585
ft.DataCell(content=ft.Text(dessert.name)),
8686
ft.DataCell(content=ft.Text(dessert.calories)),

src/flet_datatable2/__init__.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""DataTable2 control"""
2-
3-
from flet_datatable2.datacolumn2 import DataColumn2, Size
4-
from flet_datatable2.datarow2 import DataRow2
5-
from flet_datatable2.datatable2 import DataTable2
1+
from .datacolumn2 import DataColumn2
2+
from .datarow2 import DataRow2
3+
from .datatable2 import DataTable2
4+
from .types import DataColumnSize, DataColumnSortEvent

src/flet_datatable2/datacolumn2.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
from dataclasses import dataclass
2-
from enum import Enum
31
from typing import Optional
42

53
import flet as ft
4+
from .types import DataColumnSize
65

76
__all__ = ["DataColumn2"]
87

98

109
@ft.control("DataColumn2")
1110
class DataColumn2(ft.Control):
1211
"""
13-
Column configuration for a [DataTable2](datatable2.md).
12+
Column configuration for a [`DataTable2`](datatable2.md).
1413
1514
One column configuration must be provided for each column to display in the table.
1615
17-
Additional to Flet [DataColumn](https://flet.dev/docs/controls/datatable/#datacolumn), adds the capability to set relative column size via size property.
16+
Extends Flet [`DataColumn`](https://flet.dev/docs/controls/datatable/#datacolumn),
17+
adds the capability to set relative column size via size property.
1818
"""
1919

2020
label: ft.Control
@@ -27,7 +27,7 @@ class DataColumn2(ft.Control):
2727

2828
fixed_width: ft.OptionalNumber = None
2929
"""
30-
Defines absolute width of the column in pixels (as opposed to relative `size` used by default).
30+
Defines absolute width of the column in pixels (as opposed to relative [`size`][..] used by default).
3131
"""
3232

3333
heading_row_alignment: Optional[ft.MainAxisAlignment] = None
@@ -42,9 +42,10 @@ class DataColumn2(ft.Control):
4242
The contents of cells of columns containing numeric data are right-aligned.
4343
"""
4444

45-
size: Optional[Size] = None
45+
size: Optional[DataColumnSize] = DataColumnSize.S
4646
"""
47-
Column sizes are determined based on available width by distributing it to individual columns accounting for their relative sizes. Value is of type `Size` and defaults to `Size.S`.
47+
Column sizes are determined based on available width by distributing
48+
it to individual columns accounting for their relative sizes.
4849
"""
4950

5051
on_sort: ft.OptionalEventCallable[ft.DataColumnSortEvent] = None

src/flet_datatable2/datatable2.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ class DataTable2(ft.ConstrainedControl):
7575

7676
sort_ascending: bool = False
7777
"""
78-
Whether the column mentioned in `sort_column_index`, if any, is sorted in ascending order.
78+
Whether the column mentioned in [`sort_column_index`][..],
79+
if any, is sorted in ascending order.
7980
8081
If `True`, the order is ascending (meaning the rows with the smallest
8182
values for the current sort column are first in the table).
@@ -88,11 +89,12 @@ class DataTable2(ft.ConstrainedControl):
8889
"""
8990
Whether the control should display checkboxes for selectable rows.
9091
91-
If `True`, a `Checkbox` will be placed at the beginning of each row that is selectable.
92+
If `True`, a [`Checkbox`](https://flet.dev/docs/controls/checkbox)
93+
will be placed at the beginning of each row that is selectable.
9294
However, if `DataRow.on_select_changed` is not set for any row, checkboxes will not
9395
be placed, even if this value is `True`.
9496
95-
If `False`, all rows will not display a [`Checkbox`](https://flet.dev/docs/controls/checkbox).
97+
If `False`, all rows will not display a `Checkbox`.
9698
"""
9799

98100
show_heading_checkbox: bool = True
@@ -191,10 +193,10 @@ class DataTable2(ft.ConstrainedControl):
191193

192194
data_row_color: ft.ControlStateValue[ft.ColorValue] = None
193195
"""
194-
The background [color](/docs/reference/colors) for the data rows.
196+
The background [color](https://flet.dev/docs/reference/colors) for the data rows.
195197
196198
The effective background color can be made to depend on the
197-
[`ControlState`](/docs/reference/types/controlstate) state,
199+
[`ControlState`](https://flet.dev/docs/reference/types/controlstate) state,
198200
i.e. if the row is selected, pressed, hovered, focused, disabled or enabled.
199201
The color is painted as an overlay to the row.
200202
@@ -250,7 +252,7 @@ class DataTable2(ft.ConstrainedControl):
250252

251253
heading_text_style: Optional[ft.TextStyle] = None
252254
"""
253-
See DataTable [heading_text_style](https://flet.dev/docs/controls/datatable#heading_text_style).
255+
The text style for the heading row.
254256
"""
255257

256258
heading_row_decoration: Optional[ft.BoxDecoration] = None
@@ -260,7 +262,11 @@ class DataTable2(ft.ConstrainedControl):
260262

261263
horizontal_margin: ft.OptionalNumber = None
262264
"""
263-
See DataTable [horizontal_margin](https://flet.dev/docs/controls/datatable#horizontal_margin).
265+
The horizontal margin between the edges of the table and the content
266+
in the first and last cells of each row.
267+
268+
When a checkbox is displayed, it is also the margin between the
269+
checkbox the content in the first data column.
264270
"""
265271

266272
clip_behavior: ft.ClipBehavior = ft.ClipBehavior.NONE
@@ -273,11 +279,11 @@ class DataTable2(ft.ConstrainedControl):
273279
Invoked when the user selects or unselects every row,
274280
using the checkbox in the heading row.
275281
276-
If this is `None`, then the `DataRow.on_select_change`
282+
If this is `None`, then the [`DataRow.on_select_change`]()
277283
callback of every row in the table is invoked appropriately instead.
278284
279285
To control whether a particular row is selectable or not,
280-
see [`DataRow.on_select_change`][(p).datarow2.].
286+
see [`DataRow2.on_select_change`][datarow2.md].
281287
This callback is only relevant if any row is selectable.
282288
"""
283289

0 commit comments

Comments
 (0)