NIB / DOCUMENTATION
Data table — NibComponents
Sort task counts, select real rows, and inspect loading or empty states.
Open interactive viewLet the table sort local data
Tap Tasks to sort the numeric count, then tap it again to change direction. NibDataColumn.sortValue supplies a comparable value; cellBuilder decides what appears in the cell. The preview omits onSort so NibDataTable performs local sorting.
Providing onSort changes that contract: the host becomes responsible for supplying rows in the requested order, for example after a server query. A logging callback is enough to disable built-in sorting, so do not add onSort merely to observe it without also handling the order.
Choose a selection model
Selection mode none omits selection behavior, single selects one row when tapped, and multi adds row checkboxes and a header select-all checkbox. The readout observes the actual NibDataTableController.selected set. Clear selection calls the controller.
The controller stores NibDataTableSort and selected rows. setSort, setSelected, toggleSelected, and clearSelection support external actions. NibSortDirection includes none, ascending, and descending. Use stable row identity or rowKey across rebuilds; rebuilding equivalent objects with different identity can break selection expectations.
Show loading and empty results honestly
Show loading replaces rows with the package’s loading presentation. It is a local state toggle, not a network request. Filtering project names changes the real rows supplied to the table; an unmatched query shows the configured emptyState.
Selection is controller state, so a row filtered out of view can remain selected. Decide whether to retain or clear hidden selections in your application. The table does not implement backend pagination, authorization, or request cancellation.
Bound the viewport and preserve readable cells
The table needs bounded height for its virtualized body. headerHeight defaults to 48, and stickyHeader keeps headings visible while rows scroll. Column widths or minWidth determine when horizontal scrolling is needed. This demo leaves room for two columns and the optional selection column.
NibCellBuilder and NibSortValueGetter are the public callback types. Use compact cell content at a fixed rowHeight; wrapping a large paragraph into a short row can clip it. Test keyboard interaction, long values, larger text, and horizontal scroll with your actual data.