Skip to content

Data grid guide

The data grid is the largest subsystem in the kit: the hc-datagrid component, the Data grid page template, and thirteen recipes that each add one operation a business grid is used for. Each of those pages documents its own markup and server contract in full — this page is the map: what exists, what depends on what, and the order a real grid grows in.

  1. The component — the markup: sticky multi-level headers, frozen columns, numeric columns, states, and installDatagrid()’s keyboard model. Render your data with it before adding any operation.
  2. The page template — the layout the grid sits in: an app shell where only the grid scrolls, the filter panel, and the chrome placement rules. Copy it rather than rediscovering its height rule.
  3. Add operations as recipes — each stage below is independent; take only what the screen needs.

No recipes yet: everything here is the component and the template.

You need to…Where it lives
sticky headers, frozen columns, multi-level headersStructure · Trailing frozen columns
right-aligned amounts, conditional formatting, row ordinalsNumeric columns · Conditional formatting · Row ordinals
the page layout where only the grid scrollsData grid page template

Every read operation is the same wire: a form GETs the grid URL with namespaced params, and the server re-renders the grid (and the control’s own state) from them.

You need to…Recipe
page from the serverDatagrid pagination
an editable, ordered sort setDatagrid sort
per-column filtersDatagrid filter
per-user column choiceDatagrid columns
remembered widths and orderDatagrid prefs
open a row’s record and come back to the same listRow detail
name the current filters and recall them as linksSaved views
bound what one search may returnResult cap

Inline editing’s markup and keyboard model live on the component page; the two recipes are its error wires — each row is its own record tbody, so both re-render one record atomically.

You need to…Recipe
reject a bad commit — 422 re-renders the record with the marked cellDatagrid edit errors
optimistic locking per row — a stale save 409s into a conflict rowDatagrid edit conflict
You need to…Recipe
select rows and POST one action against all of themDatagrid bulk actions
bulk failures grouped by reason, rows linked from the reportDatagrid bulk errors
endless lists without page numbersDatagrid infinite — requires --hc-datagrid-max-height: none; see the recipe
a work queue frozen at search timeDatagrid snapshot pager
hierarchy inside the gridDatagrid tree
  • Errors & recovery — the status-code map (422 / 409 / 401) the edit and bulk wires build on.
  • Filterbar — the condition read-out strip the template composes above the grid.
  • Table — the static semantic table, for when you don’t need a grid at all.