TableState

Mutable state holder for a table instance. Manages column order/widths, sorting, filters and selection.

Types

Link copied to clipboard
data class SelectedCell<C>(val rowIndex: Int, val column: C)

Properties

Link copied to clipboard

Whether automatic width fitting has been applied for the first data batch render.

Link copied to clipboard

Whether automatic width fitting has been applied for the empty (header-only) state.

Link copied to clipboard
Link copied to clipboard

Tracks the maximum measured minimal content width per column across visible rows. Used to auto-fit columns on demand.

Link copied to clipboard

Tracks header widths separately. These are preserved during auto-width recalculation and used as base values after reset.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Currently focused editable column, or null if not editing

Link copied to clipboard

Currently editing row index, or null if not editing

Link copied to clipboard
Link copied to clipboard
var groupBy: C?
Link copied to clipboard
var onEditCancelled: (rowIndex: Int) -> Unit?

Callback when editing is cancelled

Link copied to clipboard
var onRowEditComplete: (rowIndex: Int) -> Boolean?

Callback for row edit completion validation. Returns true to allow exit, false to stay in edit mode.

Link copied to clipboard
var onRowEditStart: (rowIndex: Int) -> Unit?

Callback when row editing starts. Only called when item is non-null.

Link copied to clipboard

Tracks measured row heights in raw pixels for dynamic, precise scrolling.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Current table width computed from visible columns and their widths. Automatically recalculates when columnOrder, columnWidths, or visibleColumns change.

Functions

Link copied to clipboard

Cancel editing without validation. Calls onEditCancelled callback and clears edit state.

Link copied to clipboard
fun completeCurrentCellEdit(visibleColumns: List<ColumnSpec<*, C, *>>)

Complete editing the current cell and move to the next editable column. If no more editable columns in the row, attempts to complete row edit.

Link copied to clipboard
fun focusRow(index: Int)

Set focused row to index without toggling selection.

Link copied to clipboard
fun groupBy(column: C?)

Enable or disable grouping by a column

Link copied to clipboard
fun moveColumn(fromIndex: Int, toIndex: Int)

Move a column from fromIndex to toIndex within the current order. Indices are validated; dropping after the last element is supported.

Link copied to clipboard

Recalculate auto-widths for columns with autoWidth enabled.

Link copied to clipboard
fun resizeColumn(column: C, action: ColumnWidthAction)

Apply a width action for a column (set or reset override).

Link copied to clipboard
fun resolveColumnWidth(key: C, spec: ColumnSpec<*, C, *>? = null): Dp

Resolves the effective width for a column given its key and optional spec.

Link copied to clipboard
fun selectCell(rowIndex: Int, column: C)

Select a specific cell at rowIndex and column.

Link copied to clipboard
fun setColumnOrder(newOrder: List<C>)

Replace current column order with newOrder. Missing keys are ignored; unknown keys appended.

Link copied to clipboard
fun setColumnWidths(widths: Map<C, Dp?>)

Apply external widths in bulk. Null width removes override for that column.

Link copied to clipboard

Set the column width override to the tracked maximum minimal content width (if available). No-op if no measured width is present for the column.

Link copied to clipboard
fun <T> setFilter(column: C, state: TableFilterState<T>?)

Set or clear filter state for column. Pass null to remove.

Link copied to clipboard
fun setSort(column: C, order: SortOrder? = null)

Toggle or set sorting for a column. If order is null, cycles ASC -> DESC -> none.

Link copied to clipboard
fun startEditing(item: Any?, rowIndex: Int, column: C): Boolean

Start editing a specific row and column.

Link copied to clipboard
fun toggleCheck(index: Int)

Toggle checkmark state for index in Multiple selection mode.

Link copied to clipboard
fun toggleCheckAll(count: Int)

Check/uncheck all rows based on current count in Multiple selection mode.

Link copied to clipboard
fun toggleSelect(index: Int)

Toggle row selection for index according to TableSettings.selectionMode.

Link copied to clipboard

Attempt to complete the current row edit. Calls onRowEditComplete callback to validate.

Link copied to clipboard
fun updateMaxContentWidth(column: C, width: Dp, source: String)

Update the tracked maximum minimal content width for a column. If the provided width is greater than the stored value, it will be recorded.

Link copied to clipboard
fun updateRowHeight(index: Int, heightPx: Int)

Record measured row height (in px) for index.