Skip to content

DataGrid

Sortable, filterable, pageable table. The server renders every row, so no-JS readers and search engines see the full table; the script enhances in place with sorting, filtering, pagination, and row selection.

Invoices

Invoices
CustomerAmountStatus
Ada Lovelace1200Paid
Grace Hopper850Pending
Alan Turing2300Overdue
Katherine Johnson1450Paid
Margaret Hamilton1980Pending
Barbara Liskov1100Paid
Frances Allen1750Overdue
Carol Shaw960Pending
Anita Borg1620Paid
Radia Perlman2100Pending
Lynn Conway1340Paid
Sophie Wilson1875Overdue

Page 1 of 3Showing 1–5 of 12

<DataGrid
  id="invoices"
  label="Invoices"
  name="invoices"
  columns={invoiceColumns}
  rows={invoices}
  rowKey="id"
  selectable
  pageSize={5}
/>

Plain variant

A grid with no sorting, filtering, selection, or pagination chrome: all rows, always visible.

Team
NameRole
Ada LovelaceEngineer
Grace HopperLead
Alan TuringResearcher

Page 1 of 1Showing 1–3 of 3

<DataGrid
  id="team"
  label="Team"
  columns={teamColumns}
  rows={team}
  rowKey="id"
  filterable={false}
  pageSize={10}
/>

Props

PropTypeDefaultDescription
idstring-Grid id; prefixes the filter input id.
labelstring-Table caption and filter input name.
namestringidHidden inputs form name (selected ids).
columnsArray<{ key; header; sortable?; align? }>-Column defs; sortable enables header sorting.
rowsArray<Record<string, string | number>>-All rows, rendered server-side.
rowKeystring-Column key holding the unique row id.
selectablebooleanfalseRow checkboxes plus select-all header.
filterablebooleantrueShow the filter search input.
pageSizenumber5Rows per client page.
stripedbooleanfalseAlternating row treatment.
classstring-Style passthrough.

No-JS behavior

Without JavaScript the full table renders: every row, realth scope="col" headers, caption, and visible row checkboxes. Sorting, filtering, and pagination are enhancements only.

Events

Selection changes dispatch ink:grid:change with{ selected: string[] }. Selected ids also submit with the form via hidden inputs named name.

Accessibility