Back to Flet

Overview

website/docs/controls/datatable2/index.md

0.85.0.dev21.6 KB
Original Source

import TabItem from '@theme/TabItem'; import Tabs from '@theme/Tabs'; import {ClassAll, CodeExample, Image} from '@site/src/components/crocodocs';

DataTable2

Enhanced data table for Flet that adds sticky headers, fixed rows/columns, and other UX improvements via the flet-datatable2 extension.

It wraps the Flutter data_table_2 package.

Platform Support

PlatformWindowsmacOSLinuxiOSAndroidWeb
Supported

Usage

Add flet-datatable2 to your project dependencies:

<Tabs groupId="uv--pip"> <TabItem value="uv" label="uv"> ```bash uv add flet-datatable2 ``` </TabItem> <TabItem value="pip" label="pip"> ```bash pip install flet-datatable2 # (1)! ```
  1. After this, you will have to manually add this package to your requirements.txt or pyproject.toml. </TabItem>
</Tabs>

Examples

Empty state

<CodeExample path={frontMatter.examples + '/empty_state/main.py'} language="python" />

<Image src={frontMatter.example_images + '/empty_state.png'} width="55%" />

Sortable and selectable

<CodeExample path={frontMatter.examples + '/sortable_and_selectable/main.py'} language="python" />

<Image src={frontMatter.example_media + '/sortable_and_selectable.gif'} width="65%" />

Column widths

<CodeExample path={frontMatter.examples + '/column_widths/main.py'} language="python" />

<Image src={frontMatter.example_images + '/column_widths.png'} width="65%" />

Description

<ClassAll name="flet_datatable2.DataTable2" />