CamoDataTable
Rows of records in columns, with sorting, selection and an optional footer. The app owns the data, the sort
(and does the sorting) and the selection (a set of rowKeys; null means rows can't be selected). A click
on a header of a sortable column calls onSortChange; a click or Space on a row toggles its selection (a
click calls onRowClick instead when it is set); Up and Down move between rows. caption names the table.
Rows are lazy; the header stays above them. With a columnState the user can resize, hide and reorder the
columns (see CamoColumn); null keeps the columns as given. With a speedSearch typing in the rows filters
them (or jumps) by the columns that give their text; draw the matches in your cells with
CamoHighlightedText(text, speedSearch.match(text).orEmpty()).
API
- Kotlin
- Dart
public fun <T> CamoDataTable(
columns: List<CamoColumn<T>>,
rows: List<T>,
rowKey: (T) -> Any,
caption: String,
modifier: Modifier = Modifier,
sort: TableSort? = null,
onSortChange: ((TableSort) -> Unit)? = null,
selection: Set<Any>? = null,
onSelectionChange: ((Set<Any>) -> Unit)? = null,
onRowClick: ((T) -> Unit)? = null,
empty: (@Composable () -> Unit)? = null,
loading: Boolean = false,
footer: (@Composable () -> Unit)? = null,
columnState: CamoColumnState? = null,
speedSearch: CamoSpeedSearchState? = null,
)
| Name | Type | Default |
|---|---|---|
columns | List<CamoColumn<T>> | required |
rows | List<T> | required |
rowKey | (T) -> Any | required |
caption | String | required |
modifier | Modifier | Modifier |
sort | TableSort? | null |
onSortChange | ((TableSort) -> Unit)? | null |
selection | Set<Any>? | null |
onSelectionChange | ((Set<Any>) -> Unit)? | null |
onRowClick | ((T) -> Unit)? | null |
empty | (@Composable () -> Unit)? | null |
loading | Boolean | false |
footer | (@Composable () -> Unit)? | null |
columnState | CamoColumnState? | null |
speedSearch | CamoSpeedSearchState? | null |
Why CamoDataTable works this way, its states and its edge cases: contributor docs.