Skip to content

0.3.0

Choose a tag to compare

@stephenWanjala stephenWanjala released this 16 Aug 18:37
· 34 commits to master since this release
c1874e5

What's Changed

No signatures changed, so 0.3.0 compiles against 0.2.0 call sites untouched. Three behaviour
changes are worth checking.

Sorting and pagination are properly controlled

Supplying onSortChange, onMultiSortChange, or onPageChange now makes that piece of state
controlled: the table renders the parameter and never changes it on its own.

In 0.2.0 the table kept an internal copy that it updated on interaction regardless, so a caller
who passed the callback but ignored the parameter still saw sorting work. That now does nothing
visible — the click fires the callback, and the table waits for you to feed the value back:

// Broken in 0.3.0: the callback fires, but sortBy never changes
DataTable(
    sortBy = SortState(),                     // constant!
    onSortChange = { analytics.track(it) },
)

// Correct: hoist it
var sort by remember { mutableStateOf(SortState()) }
DataTable(
    sortBy = sort,
    onSortChange = { sort = it; analytics.track(it) },
)

Passing no callback is unchanged — the table owns the state, and click-to-sort works with no wiring.

Nested headers render

DataTableHeader.children was accepted and silently ignored in every version up to 0.2.0. If you
set it, expecting nothing, you now get a grouped header; both throw rather
than misrender.

Misconfigured frozen columns throw

fixed = true without a width used to be quietly demoted to a normal scrolling column. It now
throws with a message naming the column. If pinning appeared not to work for you before, this is
why, and the fix is to give the column an explicit width.

Also in this release

  • manualSorting, manualPagination, and totalItems for server-side data.
  • Reworked pagination footer: grouped controls, a divider above it, hover states, and a
    rows-per-page menu that opens upward instead of off the bottom of the window.
  • DataTableHeader and SortState are @Immutable, and Compose is exposed as api rather
    than implementation so consumers get it transitively.
  • Press-and-drag no longer pans the table horizontally; wheel and trackpad scrolling are
    unchanged. This also stops drags fighting the column resize handles.

Focus now stays on its row when the table is re-sorted, instead of holding a fixed position.
If the focused row leaves the view — filtered out, or on another page — the next arrow key
starts again from the first row.

Fixes that may change what you see

No API change needed for these, but the rendering differs:

  • Alternating row colors were offset by the total item count, flipping which rows were
    tinted on odd-sized lists. They now start correctly at the first row.
  • The keyboard focus indicator never appeared in any configuration. It now renders on the
    focused row, so a focusedRowBorder color you set in 0.1.x becomes visible for the first time.
  • Enter and Space acted on the wrong row when groupBy was set, because navigation walked
    the pre-grouping order. They now follow display order.
  • Arrow-key scrolling overshot when group headers or summaries were present.

Full Changelog: v0.2.0...0.3.0