Data table with single-column sorting, AND text filters, paging, selection and custom cells.
TxDataGrid
| Parameter | Type | Default | Meaning |
|---|---|---|---|
| dataSource | Object | required | List, configuration or DataSource instance; takes precedence over items. |
| keyOf | Object Function(T row) | required | Reads the stable record key. |
| columns | List<TxColumn<T>> | required | Column or card field configurations. |
| filterRow | bool | true | Shows the text filter row. |
| pageSize | int | 10 | Records per page. |
| pageIndex | int? | null | Zero-based page index. |
| onPageIndexChanged | ValueChanged<int>? | null | Reports pageIndex; update controlled state in the callback. |
| selection | TxSelectionMode | TxSelectionMode.none | Selection mode. |
| selectedRowKeys | Set<Object>? | null | Controlled set of selected row keys. |
| onSelectedRowKeysChanged | ValueChanged<Set<Object>>? | null | Reports selectedRowKeys; update controlled state in the callback. |
| onSelectionChanged | ValueChanged<TxSelection<T>>? | null | Reports selection; update controlled state in the callback. |
| onRowClick | ValueChanged<T>? | null | Reports the clicked record. |
| onSortChanged | void Function(String? field, bool descending)? | null | Reports sort; update controlled state in the callback. |
| onFilterChanged | ValueChanged<Map<String, String>>? | null | Reports filter; update controlled state in the callback. |
| loading | bool | false | Shows the loading state. |
| disabled | bool | false | Disables interaction. |
| noDataText | String | 'Keine Daten vorhanden.' | Text for an empty collection. |
| label | String | 'Datentabelle' | Label or accessible name. |
import 'package:flutter/material.dart';
import 'package:tecexpress/tecexpress.dart';
Widget example() {
final rows = <Map<String, Object>>[{'id': 1, 'name': 'Alex'}];
return TxDataGrid<Map<String, Object>>(dataSource: rows, keyOf: (row) => row['id']!, columns: [TxColumn(caption: 'Name', valueGetter: (row) => row['name'])]);
}