Data grid / foldkit-data-grid

How rows, columns, and geometry stay separate

The grid owns interaction state and geometry; your application owns the records, sort order, and domain mutations.

FactOwner
the records, their loading and cachingyour application, Remote, or a local store
row order: a sort, a filter, a searchyour application's Model or query input
column order, visibility and pinningthe grid, as a ColumnLayout
which cells exist and where they standGridProjection, derived from the three above

Sorting, filtering, and data fetching stay in your application: the grid renders rows in the order you pass them. A RowModel (rows by index, each with a stable key) crosses with Columns (by stable id) and ColumnLayout (start, center, end, or hidden) to build GridProjection. Because cells are named by { row: key, column: id } rather than array index, a re-sort moves a row to a new visual index while keeping the cell's identity intact.

For a simple readable, sortable table without spreadsheet cell movement or ranges, use foldkit-crud's Crud.list with foldkit-mixins-crud.

Movement and ranges

moveBy(address, { rows, columns }) steps in display order: it crosses from the pinned start into the center, skips hidden columns, and stops at the edges. rowStart, rowEnd, first and last jump to the edges. box(anchor, focus) is the rectangle two cells span, from either corner, as row indexes [start, end) and the columns it covers.

Every answer is an Option. A cell is absent when its column is hidden, its row is gone, or its row is counted but not loaded yet.