Skip to content

Introduction

DataTable2 Control for Flet based on DataTable2 package for Flutter.

DataTable2 features fixed/sticky header/top rows and left columns and many other useful features additionally to all the properties of built-in Flet DataTable.

Installation

Add dependency to pyproject.toml of your Flet app:

dependencies = [
  "flet-datatable2 @ git+https://github.com/flet-dev/flet_datatable2.git",
  "flet>=0.27.4",
]

Build your app:

flet build macos -v

Examples

Live example

DataTable2 with empty property and no data rows

import flet as ft
from flet_datatable2 import DataColumn2, DataTable2

def main(page: ft.Page):
    page.add(
        DataTable2(
            columns=[
                DataColumn2(ft.Text("First name")),
                DataColumn2(ft.Text("Last name")),
                DataColumn2(ft.Text("Age"), numeric=True),
            ],
            empty=ft.Text("This table is empty."),
        ),
    )


ft.app(main)

DataTable2 with fixed heading row and sorting

See source code for this example here.

Classes

DataTable2

DataColumn2

DataRow2