| title | Plugin Grid |
|---|
Advanced data grid with sorting, filtering, pagination, and row selection capabilities.
npm install @object-ui/plugin-gridThis package publishes a stylesheet. Import it after the base sheets, or the grid renders unstyled — the themed utilities it uses have no other source in a published app (#4929):
/* src/index.css */
@import "tailwindcss";
@import "@object-ui/components/style.css";
@import "@object-ui/fields/style.css";
@import "@object-ui/plugin-grid/style.css";The props an object-grid node reads on a page are generated from the spec into the component reference; this page covers using the plugin from React.
- Sorting - Multi-column sorting support
- Filtering - Column-level filtering
- Pagination - Built-in pagination controls
- Row Selection - Single and multi-row selection
- Custom Cells - Custom cell renderers
- Responsive - Mobile-friendly layouts
import '@object-ui/plugin-grid';That single import is the whole of registration — there is no components map to
iterate over. Importing the entry runs the two ComponentRegistry.register(...)
calls in packages/plugin-grid/src/index.tsx, which claim exactly these schema
types:
| Namespaced key | Bare-name fallback | Renderer behind it |
|---|---|---|
plugin-grid:object-grid |
object-grid |
ObjectGridRenderer — the data grid, queried from an object |
view:grid |
none — skipFallback: true |
the same renderer, under the view protocol |
ComponentRegistry.register publishes namespace:type, and — unless the call
passes skipFallback: true — the bare type as a back-compat fallback
(packages/core/src/registry/Registry.ts:194, fallback at :226).
The import-wizard node key is RETIRED (objectui#10859 batch 8): no schema
produced it, and objectui validate refused it at type. ImportWizard is still
exported, and @object-ui/app-shell mounts it directly (the object view's import
flow).
Bare grid is deliberately not this plugin's. skipFallback: true on the
view:grid call keeps the data grid from claiming it, because grid belongs to
the CSS Grid layout container in @object-ui/components
(packages/components/src/renderers/layout/grid.tsx:50). Reach the data grid as
object-grid, or as view:grid when you want the namespaced spelling.
To serve the data grid under a key of your own, register the exported renderer — that is what a manual registration is here:
import { ComponentRegistry } from '@object-ui/core';
import { ObjectGridRenderer } from '@object-ui/plugin-grid';
ComponentRegistry.register('my-grid', ObjectGridRenderer, {
namespace: 'my-app',
label: 'My Grid',
category: 'plugin',
});ObjectGrid, ObjectGridRenderer, VirtualGrid, SplitPaneGrid,
ImportWizard, InlineEditing and FormulaBar are on the package's export
surface, alongside the hooks (useGroupedData, useColumnSummary,
useCellClipboard, …) and the component prop types
(ObjectGridComponentProps, VirtualGridProps, …). There is no aggregate map
among them, and the schema types are not here either — they live in
@object-ui/types, because the schema is the shared authoring contract rather
than this package's component API.
Columns sort by default. sortable is a per-column key, used to turn a
column off; the grid-level sort declares the order the grid opens with. There
is no top-level sortable switch.
{
"type": "object-grid",
"properties": {
"objectName": "users",
"sort": [{ "field": "created", "order": "desc" }],
"columns": [
{ "field": "name", "label": "Name" },
{ "field": "email", "label": "Email", "sortable": false }
]
}
}A click on a sortable column header sorts by that column; another click on it changes the direction.
On an object's list page the header opens a menu instead
(objectstack#35876), which its host turns on (the headerMenu component
prop, not a schema key): Sort ascending, Sort descending and Hide
column. A column that does not sort offers Hide column alone. The
header itself never changes the sort. Enter, Space or ArrowDown
on the focused header opens the same menu; the arrows move through it, Enter
chooses and Escape closes it without touching the sort.
- With no sort, or a single level, the column picked in the menu replaces the sort.
- With two levels or more it becomes the first level and every other level keeps its place after it; a column already in the sort moves up with the picked direction. No level is dropped.
- The ↑1 / ↓2 marks on the headers show each level's place.
- A sort chip under the view bar opens every level in one panel (it does not reverse the direction). Each level's handle reorders it: drag it to another row, or press ArrowUp / ArrowDown on the focused handle.
There is no per-column filter key and no top-level filterable switch. A grid
narrows its query two ways: a filter baked into the metadata, and a toolbar
search over the fields named in searchableFields.
{
"type": "object-grid",
"properties": {
"objectName": "users",
"filter": [
{ "field": "status", "operator": "equals", "value": "active" },
{ "field": "created", "operator": "after", "value": "2026-01-01" }
],
"searchableFields": ["name", "email"],
"columns": ["name", "email", "status"]
}
}rowActions and bulkActions are lists of action names — the actions
themselves live in the object's action set, so the same action behaves
identically wherever it is offered. They are string[], not inline definitions
carrying callbacks.
{
"type": "object-grid",
"properties": {
"objectName": "users",
"columns": ["name", "email"],
"rowActions": ["view", "edit", "delete"],
"selection": { "type": "multiple" },
"bulkActions": ["delete", "export"]
}
}A name in bulkActions runs that action once per selected record. If the
action declares params, the selection bar's dialog collects them once, before
the run, and resolves them as the record page's action dialog does. A
field-backed param ({ "field": "crm_campaign", "objectOverride": "crm_campaign_member" }) takes its type, label, options, default and picker
target from that field, so a lookup param renders the record picker and the
confirm step shows the picked record's label. A param whose field is not in
the object metadata is refused, and the run is blocked.
The confirm step lists the affected records by their display title — the
object's nameField, resolved as the record header resolves it — for every
bulk action, whether it runs once per record or once over the selection. A
record with no title to show is listed as Record # followed by its id.
The selection bar offers a write only to a caller who may make it. A bulk Delete
is the rowDelete row of the affordance-to-grant map (@object-ui/core), and a
bulkActionDefs entry with operation: 'update' — a patch written to every
selected record — is the rowEdit row, the same rows the row menu's Delete and
Edit read: the object's policy, the effective API operation set and the
caller's delete or update grant. A closed row removes the button, and
with it the dialog, its undo and its retry. custom entries are unchanged.
With no permission provider mounted both read open.
Edit and Delete also fold the server's verdict on each row: writeScope,
sharing rules and row-level security can refuse a record the object grant
allows. The grid asks for that verdict (POST /api/v1/security/explain, one
batch per operation for the rows on the page) when a row's actions are first
reached for — a pointer or the focus on the actions cell, or a row menu opening
— and never on the list's first paint. Until the answer lands every row keeps
the object-level verdict, and an open menu shows Edit and Delete inert; an item
the answer refuses then goes. A failed or missing answer keeps the object-level
verdict.
onRowClick, onRowSelect, onCellChange, onRowSave, onBatchSave,
onEdit, onDelete, onBulkDelete and onAddRecord are React props on
ObjectGridComponentProps. They are functions, so no metadata document can hold
them, and writing one of them into a schema does nothing at all: the grid builds
the inner table's handlers itself and never reads any of these nine off the
schema.
The one callback the grid does read off the schema is onNavigate, declared on
ObjectGridSchema for programmatic callers only. It is a function value too, so
it is no more authorable than the nine — it is deliberately absent from the
manifest and the designer panel, and prefer passing it as a prop
(objectui#5234, maintainer ruling of 2026-08-19).
import { ObjectGrid } from '@object-ui/plugin-grid';
import type { ObjectGridComponentProps } from '@object-ui/plugin-grid';
export const Grid = (props: ObjectGridComponentProps) => (
<ObjectGrid
{...props}
onRowClick={(record) => console.log('Row clicked:', record)}
onRowSelect={(rows) => console.log('Selection changed:', rows)}
/>
);Note onRowSelect — the prop that reports a selection change is spelled that
way; there is no onSelectionChange on this component.
The declarative alternative, which is metadata and survives a round trip
through storage, is navigation: its mode decides what a row click does
without any host code.
operations and the onEdit / onDelete wiring are GRID-level: they decide
whether the generic Edit / Delete entries exist at all, identically for every
row. When the refusal belongs to one RECORD — a system field a designer may not
drop — use rowOperations, a component prop called with a row record that
answers for that row alone. Mounting <ObjectGrid> directly hands it the node as
it reads it, so its schema prop is the flat ObjectGridSchema, with no bag:
import { ObjectGrid } from '@object-ui/plugin-grid';
import type { ObjectGridSchema } from '@object-ui/types';
const schema: ObjectGridSchema = {
type: 'object-grid',
objectName: 'field_definition',
columns: ['name', 'label', 'type'],
};
export const FieldList = ({ isSystem }: { isSystem: (name: string) => boolean }) => (
<ObjectGrid
schema={schema}
onEdit={(record) => console.log('edit', record)}
onDelete={(record) => console.log('delete', record)}
rowOperations={(record) => ({ delete: !isSystem(String(record.name)) })}
/>
);It speaks the same update / delete vocabulary as the authored operations
block, and it is an intersection, never a union: false withholds the
entry, while true, an omitted member, and a null / undefined return all
leave the grid's own verdict alone. Nothing it returns can re-open what the
object's lifecycle bucket, its userActions, the server's effective operations,
the principal's grant or the record-level verdict already closed — and a grid
that passes no rowOperations renders exactly as it did before the prop
existed.
Prefer this over refusing inside the callback. A refusal that runs after the click ships a button that is drawn as available and then does nothing, which is indistinguishable from a broken build (objectui#8674).
A host that has something to say about one record, next to its name, passes
rowAdornment: a component prop called with a row record that returns a React
node, or null for none. The grid draws it in the cell of the object's
declared nameField when a column shows that field, else in the first shown
column (never in the row actions), and beside the card's title in the card
view. It is drawn after the cell's own content and never in place of it, so
the value, its link and its mask stay as they were. A grid that passes no
rowAdornment renders exactly as it did before the prop existed. It is a host
prop, not a schema key: list metadata cannot set it.
import { ObjectGrid } from '@object-ui/plugin-grid';
import type { ObjectGridSchema } from '@object-ui/types';
const schema: ObjectGridSchema = {
type: 'object-grid',
objectName: 'sys_user',
columns: ['name', 'email'],
};
export const UserList = ({ needsAccess }: { needsAccess: (id: string) => boolean }) => (
<ObjectGrid
schema={schema}
rowAdornment={(record) => (needsAccess(String(record.id)) ? <span>Not authorized</span> : null)}
/>
);The console's Setup → Users list on a cloud-managed environment uses it to mark a user who holds no permission set beyond the baseline (objectui#13330).
A host that owns the row click (onRowClick) and knows that it opens nothing
for these rows passes rowOpensRecord={false}. The grid then draws its
record-link cells (the first column, and any column authored link: true) as
plain text, with no anchor and no ARIA link semantics, and the row's right-click menu
offers no Open or Open in new tab; the row's actions stay. The row click still
reaches onRowClick, so anything else the host does with it is unchanged.
On a phone, where the grid draws each row as a card, the card draws no pointer
and no hover wash, and its "⋮" stays (objectstack#33548). Absent (or true),
every row is drawn as before. It is a host prop, not a
schema key: list metadata cannot set it. The console passes false for a view
authored navigation: { mode: 'none' } or navigation.preventNavigation: true
(whatever its mode, objectstack#33549) and for an object whose data API serves
no single-record read (objectstack#33317).
Right-clicking a data cell opens the row's context menu in two sections (objectstack#36289). Above a separator, the cell's own items: Copy, Paste, Clear, then Change history (below). Under it, the row's items, unchanged: Open, Open in new tab and the row's actions. A right-click off a data cell (the selection cell, the row's "⋮" cell) opens the row's section only.
- Copy writes the cell's value to the clipboard, as Ctrl/Cmd+C on the selected cell does. A masked cell copies nothing, so it is unavailable there.
- Paste reads the clipboard and writes it into the cell as a paste on the selected cell does: the same conversion, the checks the cell's editor makes (required, length, range, the email and URL shape) and the same save. Text the column cannot read, or a value the checks refuse, is not saved and the cell says why. When the browser will not hand the clipboard over, the cell says so and names Ctrl/Cmd+V. It is offered on text, number, currency, percent, email, URL, phone, date and single-choice fields (an option is matched by value or label), and is unavailable on any other type.
- Clear empties the cell and saves it, as Backspace on the selected cell does. It is unavailable on a required field and on a yes/no field.
- Paste and Clear are unavailable on a cell the reader may not edit: a read-only or calculated field, a grid that is not editable, a record the reader may not update.
data-table hands these to the host's renderRowContextMenu as
context.cell (copy, paste, clear, each absent where the table refuses
it), beside context.column. A grid that offers no row action and no
selection opens the menu for a cell only when the cell can be changed or has a
change history; otherwise the browser's own menu stays.
Right-clicking a cell of a field the object declares adds Change history
to the row's context menu, when the grid's data source can read activity
(find), the field's changes are recorded with their values
(resolveFieldHistory from @objectstack/spec/data) and the reader may read
the field. Choosing it opens
@object-ui/plugin-detail's FieldHistoryPopover at that point: that
record's changes of that field, newest first, ten at a time, or No changes
recorded with who created the record. data-table names the cell's column to
the host's renderRowContextMenu as context.column.
Enable inline cell editing for quick data updates:
{
"type": "object-grid",
"properties": {
"objectName": "users",
"columns": [
{ "field": "id", "label": "ID" },
{ "field": "name", "label": "Name" },
{ "field": "email", "label": "Email" },
{ "field": "status", "label": "Status", "type": "select" }
],
"editable": true
}
}editable is the only switch: it is a grid-level flag, and edits persist
through the host's data source (dataSource.update) with no callback to wire.
A grid that renders editable (editable set and the reader allowed to edit
the object) uses the select-first cell model described below: a click
selects a cell, and double-click, Enter, F2 or typing opens its editor. A grid
that renders read-only keeps its click-to-open row. singleClickEdit is
retired (objectstack#36270): @objectstack/spec refuses it, and
os migrate meta deletes it from existing sources.
Features:
- Select, then edit: a click selects a cell; double-click, Enter, F2 or typing opens its editor, Enter commits, Escape cancels
- Per-field read-only: which cells open is decided by the field
definition, not by a column key — a field marked
readonly, and computed/binary field types (formula, autonumber, file, …), never open an editor. There is noeditablekey onListColumn. - Rich text edits in a panel (objectstack#36023): on a select-first grid
(
cellSelection), amarkdown,htmlorrichtextcell opens the record form's text box over the stored source in a panel under the cell, at least as wide as the column, while the cell keeps showing its value. Enter there is a new line, Ctrl/Cmd+Enter saves, Esc discards and a click outside saves. A grid withoutcellSelectionopens the text box over the cell on one click: Enter is a new line, Ctrl/Cmd+Enter does nothing, Esc discards and a click outside keeps the text as a pending change for the grid's save buttons. - Visual feedback: editable cells show a hover state, and the input is focused and selected when editing begins
- The editor floats over its cell (objectstack#35688): it opens on a layer anchored to the cell's top-left corner, at least as wide as the column and wider where its field type needs it (an address form, a record picker), so the row keeps its height and no other column moves. Near the bottom of the window the layer opens upward, near the right edge it shifts left, and a cell half hidden behind a frozen column or the header is scrolled into view first. Scrolling the cell out of sight commits the edit.
- Pickers open ready to pick (objectstack#35688): a single select or status shows its option list at once, with a search box that filters as you type; the arrow keys and Enter (or a click) pick, and the pick is saved. A multi-select is the same list with check marks, and tags list the field's tags with an "Add" row for new text; both save when you move on. A date or date-time opens its calendar while the value stays typeable in its box, with Today, Tomorrow, Next week (seven days from today) and Clear; on a date, a day or a quick pick saves. A time opens the browser's time picker, and a colour offers swatches beside its hex box (a swatch saves, Escape leaves).
To own persistence in a React host, supply onCellChange as a component
prop — it is not a schema key.
Every grid that renders editable uses the select-first cell model
(objectstack#35684, objectstack#35687, objectstack#36270): the console's list
page, the grid an object-view draws, and an authored object-grid. There is
no inline-edit mode and no toggle. On the list page the grid is editable
wherever the reader may edit the object and the view does not declare
userActions.editInline: false; elsewhere it is editable where editable is
set and the reader may edit the object. A React host can pass the
cellSelection component prop (not a schema key) as false to keep the staged
model described under Batch Editing.
- A click selects a cell (a ring around it); it neither edits nor opens the record. Only the name link keeps its own click (it opens the record). Every other link a cell draws (an email, a phone number, a URL, a file, a user chip, an image thumbnail, and a lookup chip unless the host opens it in place, below) is selected by a click too (objectstack#36015); to open it, Ctrl/Cmd-click it, press the Open button the selected cell shows on hover, or press Ctrl/Cmd+Enter. A cell of several chips opens the first one that way. The email and phone cells draw no copy button here: Ctrl/Cmd+C copies the selected cell. On a touch screen a tap opens the record.
- A lookup chip opens its record in place when the host passes
openReferencedRecord(the console's list page opens it in the side drawer, over the list): a single click on the chip opens that record, a click beside it selects the cell, and Ctrl/Cmd+Enter opens the first chip the same way. A lookup cell draws an Edit (pencil) button on hover and while selected, which opens its editor; it is not drawn when the cell cannot be edited, and it takes the place of the Open button. A chip naming a person (a lookup tosys_user) keeps the click-selects behaviour above. - A cut-off value shows in full when its cell is selected: a long text, a multi-line text or a list of tags that the column truncates opens on a layer over the cell, wrapped, scrolling inside past a few lines. Escape, an arrow key or a click elsewhere closes it; Enter or a double-click turns it into the editor in the same place and at the same size.
- Editing starts on a double-click, Enter or F2 (the value kept, caret at its end), or by typing, which replaces the value; an input method's composition is kept whole. Backspace or Delete clears the cell and saves at once; a required field keeps its value and says it is required.
- Where the editor draws (objectstack#36023): a picker (single and multi select, status, tags, date, date-time, time, colour, a lookup or a user) opens as a panel under the cell, which keeps showing its value; the date panel has the typeable box on top and the calendar beneath. Typed input, long text and an address edit in place over the cell.
- A value that fails its rules is not saved: the field's required, length, range, email or URL rule, or text a number box cannot read. The editor stays open with what was typed and says why under it; correct it and commit again, or press Escape to discard. A click elsewhere does nothing meanwhile.
- While editing, Enter commits and keeps the same cell selected, Tab / Shift+Tab commit and move right / left, and Escape cancels and keeps the cell selected. In a multi-line editor Enter is a new line and Ctrl/Cmd+Enter commits. A click elsewhere commits.
- Selected cell keys: the arrows and Tab move the selection; Space is typed like any other key and opens the editor (a checkbox cell flips instead, as do Enter and a second click on it); Ctrl/Cmd+C copies; Ctrl/Cmd+V converts the text to the field's type and commits it; Ctrl/Cmd+Enter opens the link the cell draws; Escape clears the selection. The record opens from the name link, or a tap on a touch screen.
- A cell that opens no editor says why on the cell: the field is read-only, calculated or not editable in a list, the reader may not edit the field, the object or the record, the view turned editing off, or the record is locked by an approval.
Each commit is saved at once (objectstack#35685), as one update for that record; there is no Save All bar, no row Save / Cancel and no amber row. The cell shows a small spinner while its save runs and a check mark once it landed. Only that row is redrawn, from the record the server answered with (a value a server hook rewrote shows as stored); the list is not read again, so a row whose new value would sort it elsewhere stays in place until the next load (a refresh, a sort, a filter or a page change).
- Groups and totals follow the save (objectstack#35689). A save that changes the grouping field leaves the row in its group while the user is on it; once a cell of another row is selected, the row shows in its new group and both groups' counts and subtotals are correct (a server-grouped grid reads its group headers and open groups' rows again then). Any other save is in its group's subtotals at once, and in the footer total of a flat grid.
- A refused save keeps the typed value and shows the server's reason on the cell. Escape puts the stored value back. A later edit on the same row is sent together with the refused one, as one update. When the reason names a field the list cannot edit, the notice offers to open the record.
- A newer version (409) still opens the conflict dialog: "Reload latest" re-reads the list, "Overwrite anyway" writes over it and keeps the row in place.
- Undo takes a save back: the save toast's Undo button, or Ctrl+Z (Cmd+Z on macOS) on a cell of the grid, newest save first. An undo is a new update that writes the value the record held before the save, guarded by the version this grid's own newest write of the record answered: if someone else changed the record since, the 409 dialog opens instead of their change being overwritten. The record's history shows the save and its undo as two changes. Each save is taken back once, and a refused or cancelled undo is used up too, so the next Ctrl+Z undoes the save before it. A toast's Undo takes back that toast's save, while Ctrl+Z always goes newest first. Inside an open editor Ctrl+Z stays the editor's own text undo. A save of a field the row did not read offers no Undo.
- A state-machine field asks first. When the object's
state_machinevalidation rule governs the field (an active rule whose events cover an update), picking a new value — in the cell's editor, or by pasting — opens a confirm that names the field and both values and says saving may trigger related automation ("Status changes from On Hold to Active. Saving may trigger related automation."). Cancel writes nothing and the cell keeps the value it had; Change saves it as any commit is saved. Under that sentence the confirm names the flows the move would start, each by its label in the reader's language and a flow that starts an approval marked so, as the server'sPOST /api/v1/automation/_record-startsanswers them (the record page's stage confirm reads the same answer, through@object-ui/plugin-detail'suseRecordUpdateStarts). A read that fails or names no flow leaves the sentence alone (objectstack#35928). A host asks this throughGridCellSelection.confirmCommit. - A change that makes other fields required asks for them (objectstack#35956).
When the new value makes a field's
requiredWhentrue while that field is still empty (a win reason on "Won", say), nothing is written yet: a dialog names the record and the change and asks for those fields, with the editors the record form uses, whether or not the view draws them as columns. A value typed there that makes one more field required adds it. Save writes the cell and the typed values as one update; Cancel writes nothing and the cell keeps its value. A refusal of that update stays in the dialog, under the field it names. That dialog is the confirmation, so a state-machine field does not ask twice. A field that has a value, is hidden or read-only, the reader may not write, or has no in-place editor (a file, rich text) is not asked for: the change is saved and refused as before. The kanban drop and the record page's inline Save open the same dialog (RequiredFieldsDialogin@object-ui/fields). - The record drawer follows. A record open in the list's drawer is read again when a list cell saves it. If the drawer holds unsaved edits of its own, those stay as typed, the drawer's save bar says the record was changed elsewhere, and Save writes the drawer's edits over the latest version.
A column's summary draws its calculation in the table's last row, under the
column. A host that passes residentSummaryRow draws that row on a flat table
even when nothing is declared, led by the record count. With
onColumnSummaryPick as well (wired only for a reader who may change the view),
clicking a cell opens one menu of the calculations its field type allows, the
current one ticked and None last; the grid draws the pick at once and the host
saves it as the column's summary (an answer of false takes the pick back).
summaryPickFields limits the menu to the columns the host can save. The
console's list offers it on the columns the view declares and saves only the
calculation: on a personal view at once, and on a shared view as a draft, which
the list draws, for the editor and everyone else, once it is published.
keyboardNavigation turns the grid's data cells into one roving Tab stop, on the
WAI-ARIA grid pattern (objectui#11068):
{
"type": "object-grid",
"properties": {
"objectName": "users",
"columns": ["name", "email", "status"],
"keyboardNavigation": true
}
}- One Tab stop. Tab reaches the cells once — on the cell that last held focus, or the first cell of the first row — and the next Tab moves past them. A widget a cell renders (the record link, a row's action menu, a selection checkbox) keeps its own Tab stop.
- Arrow keys move focus one cell; Home / End go to the first / last cell of the row, and Ctrl+Home / Ctrl+End to the first / last cell of the page. At an edge, focus stays put.
- Editing. On an editable grid, Enter still opens the focused cell, and an open cell's editor keeps every key. An edit ended with Enter or Escape hands focus back to its cell, so the arrows carry on from there.
- Default. Always on when the grid renders editable — the authored
editableand the viewer's permission to update the object, the same value inline editing obeys — because that grid selects a cell first and moves the selection with these keys;falsedoes not turn it off there (objectstack#36270), except where a React host keeps the staged model withcellSelection={false}(see Batch Editing below). A read-only grid keeps every cell its own Tab stop unless you writetrue. - While it is on, the table is exposed to assistive technology as a
grid. A grouped grid navigates within each group's table; the mobile card layout has no cells and is unaffected.
Edit multiple cells across multiple rows and save them individually or all at
once. This is the staged model, which no metadata selects: since
objectstack#36270 every grid that renders editable saves each cell as it is
committed (above). A React host that draws ObjectGrid itself opts back into
it by passing cellSelection={false}; then a click opens a cell's editor, and
the save/cancel affordances appear on their own once a row has pending
changes:
import { ObjectGrid, type ObjectGridComponentProps } from '@object-ui/plugin-grid';
declare const dataSource: NonNullable<ObjectGridComponentProps['dataSource']>;
export const ProductsGrid = () => (
<ObjectGrid
cellSelection={false}
dataSource={dataSource}
schema={{
type: 'object-grid',
objectName: 'products',
columns: [
{ field: 'sku', label: 'SKU' },
{ field: 'name', label: 'Name' },
{ field: 'price', label: 'Price', type: 'currency', align: 'right' },
{ field: 'stock', label: 'Stock', type: 'number', align: 'right' },
],
editable: true,
}}
/>
);Left alone, saving goes through the host's data source. A React host that needs
to own persistence supplies onRowSave / onBatchSave as component props —
and because they are props, they take the adapter from the host's own scope
rather than from anything in the schema:
import type { ObjectGridComponentProps } from '@object-ui/plugin-grid';
type Persistence = Pick<ObjectGridComponentProps, 'onRowSave' | 'onBatchSave'>;
const persistence = (
dataSource: NonNullable<ObjectGridComponentProps['dataSource']>,
): Persistence => ({
onRowSave: async (rowIndex, changes, row) => {
await dataSource.update('products', row.id, changes);
},
onBatchSave: async (allChanges) => {
await Promise.all(
allChanges.map(({ row, changes }) => dataSource.update('products', row.id, changes)),
);
},
});Features:
- Pending changes tracking: edit multiple cells across rows before saving; a cell edited back to the value it loaded with is not a pending change, and its row is no longer counted as modified
- Visual indicators: modified rows highlighted in amber, modified cells in bold
- Row-level save/cancel: individual row save and cancel buttons
- Batch operations: Save All and Cancel All buttons for bulk actions
- Flexible callbacks — all three are
ObjectGridComponentProps, never schema keys:onRowSavefor a single row,onBatchSavefor many,onCellChangefor each committed cell edit, including one that leaves the value as loaded (only a real change is staged).onBatchSaveis@deprecated: only this staged model calls it; on a select-first grid each cell saves throughonRowSave(or the grid's own write) andonBatchSaveis never called - A concurrent write is refused, not overwritten: the default saves send each
row's
updated_atasIf-Match, and an editable grid asks for that column even when no column shows it. A row someone else saved after it was read answers409, which opens the record page's conflict dialog (Reload latest, Overwrite anyway, Cancel). "Save All" reports each row on its own: a refused row stays pending and flagged, and the rows that saved are cleared.
The schema and column types come from @object-ui/types; this package exports
the component types. Neither GridSchema nor GridColumn is on this
package's export surface, and both names are taken elsewhere by different
things — GridSchema in @object-ui/types is the CSS Grid layout
container, and GridColumn in @object-ui/fields is a column of the
line-items form widget (keyed name). The data-grid pair is
ObjectGridSchema + ListColumn. ObjectGridSchema types the component's
schema prop — the node as the grid reads it, after SchemaRenderer hoists an
authored node's properties bag onto it — so its keys sit flat here.
import type { ObjectGridSchema, ListColumn } from '@object-ui/types';
import type { ObjectGridComponentProps } from '@object-ui/plugin-grid';
const nameColumn: ListColumn = {
field: 'name',
label: 'Full Name',
sortable: true
};
const grid: ObjectGridSchema = {
type: 'object-grid',
objectName: 'users',
columns: [nameColumn],
pagination: { pageSize: 20 }
};
// Row callbacks are COMPONENT props, not schema keys.
const gridProps: ObjectGridComponentProps = {
schema: grid,
onRowClick: (record) => console.log('Row clicked:', record)
};Annotating the literal is the point: an un-annotated const schema = { … }
type-checks no matter what is written in it, so a snippet that carries no
annotation cannot tell you whether its keys are real.
MIT