DataTableState

@Stable
class DataTableState(lazyListState: LazyListState, horizontalScrollState: ScrollState)(source)

State holder for DataTable.

Provides programmatic access to scroll position, focused row, and column widths. Create via rememberDataTableState.

Constructors

Link copied to clipboard
constructor(lazyListState: LazyListState, horizontalScrollState: ScrollState)

Properties

Link copied to clipboard

Index of the first visible item in the vertical list.

Link copied to clipboard

Key of the row that currently has keyboard focus, or null when no row is focused.

Functions

Link copied to clipboard
suspend fun animateScrollToItem(index: Int, scrollOffset: Int = 0)

Animates scrolling so that the given item index is visible.

Link copied to clipboard
fun focusRow(key: Any?)

Moves keyboard focus to the row with the given key, or clears focus when key is null.

Link copied to clipboard

Clears all user-resized column widths, reverting to header-defined or weighted widths.

Link copied to clipboard
suspend fun scrollToItem(index: Int, scrollOffset: Int = 0)

Scrolls the table so that the given item index is visible.