Skip to content

DataGrid

DataGrid is a two-dimensional workspace where cells are the task. Use it for arrow-key navigation, roving focus, cell editing, and deterministic recovery. Choose DataTable when reading and selecting rows is the primary interaction.

A cell-oriented workspaceUse a two-dimensional cursor and editable cells in a real grid.
Release readinessMove through cells and edit release work in place · 8 items
Overview{"cursor":null,"selected":{"kind":"explicit-rows","rowIDs":[]}}
Shift-select a row range · Arrow keys move · Enter edits · Escape cancels 0 rows selected

Only one cell participates in the tab order. Arrow keys move the cursor, Home and End move to row boundaries, and PageUp/PageDown move relative to the access window. Core emits reveal and focus commands for off-screen targets instead of touching the platform.

Navigation and focus recoveryMove with arrow keys and observe deterministic cursor recovery after data changes.
Release readinessMove through cells and edit release work in place · 8 items
Active cell{"current":null}
Shift-select a row range · Arrow keys move · Enter edits · Escape cancels 0 rows selected

When a new view removes the active row or column, the cursor recovers to a nearby row in the same column, a nearby column in the same row, or the first focusable cell. Core, DOM, and Vue share this rule.

Edit, commit, or cancel

Enter or an input action switches from navigation mode to edit mode. Commit produces a typed command; Escape restores the original value and cursor. The application owns persistence and validation copy.

Edit, commit, and cancelPress Enter to edit, then commit the value or cancel with Escape.
Release readinessMove through cells and edit release work in place · 8 items
Edit state{"kind":"navigation"}
Shift-select a row range · Arrow keys move · Enter edits · Escape cancels 0 rows selected
  • Editor can wrap a native input, select, or textarea.
  • A parser returns a wire value or a structured error.
  • Editor recovery remains deterministic when a new view arrives during editing.
  • Reload the source after persistence or synchronize an optimistic view.

Select rows independently from the cursor

The cell cursor answers “where am I working?” while row selection answers “which records receive a bulk action?”. They are independent, and row checkboxes support anchored Shift ranges.

Row selection independent from the cursorKeep cell focus while selecting rows and extending a Shift range.
Release readinessMove through cells and edit release work in place · 8 items
Selection state{"kind":"explicit-rows","rowIDs":[]}
Shift-select a row range · Arrow keys move · Enter edits · Escape cancels 0 rows selected

The range follows visible leaf-row order. A new sort or filter establishes a new order, while group and context rows are excluded.

Query server data

DataGrid shares DataTable's query and source contract. Sort and filter controls request a view rather than rearranging mounted cells. A server resolves the query and page/window access into a response envelope.

Use the async source example to inspect retained results while loading, cancellation, stale-response rejection, and retry.

Columns and large data

Column order, visibility, and pinning are controller state. Pixel size and scrolling are host state. Ordinary grids do not need virtualization; compose the consumer-installed @sectile/virtual only for genuinely large surfaces. See optional virtualization.

Find a public part

GoalVue partPrimary state or behavior
Grid boundaryRootcursor, edit mode, command boundary
HeadersHeader, HeaderRow, ColumnHeaderquery and column metadata
CellsBody, Row, Cellroving tabindex, active cell
EditingEditorbegin, commit, cancel, restore
Row selectionRowSelectionControl, BulkSelectionControlexplicit/range/all-matching
Column sizeColumnResizeHandlehost size state

Import Core from @sectile/tabular/data-grid, and DOM or Vue bindings from @sectile/dom/tabular and @sectile/vue/data-grid. See DOM and Vue for composition details.

Released under the MIT License.