Skip to content
Discussion options

You must be logged in to vote

Hi Nelson — this is a real gap in DataTable, but it's inherited from Flutter: Flutter's built-in DataColumn has no width property, so ft.DataTable has nothing to plumb through. Columns auto-size to content, and that's it.

For this exact use case, use flet-datatable2. Its DataColumn2 control adds:

  • fixed_width — absolute pixel width
  • size — relative size (S/M/L)

Combined with Text(overflow=ELLIPSIS, max_lines=1), you get the ellipsis behavior from your screenshot:

import flet as ft
import flet_datatable2 as ftd


def main(page: ft.Page):
    page.add(
        ftd.DataTable2(
            expand=True,
            columns=[
                ftd.DataColumn2(
                    label="Name",
  …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@nelson-python
Comment options

Answer selected by nelson-python
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
help wanted Extra attention is needed
2 participants