Skip to main content

Datagrid components

The table inside a list view: columns from the schema, row actions, sorting, drag-and-drop ordering and a column selector.

SchemaList mounts SchemaDatagrid for you. Use it directly inside a hand-built ListShell.

Example​

<SchemaDatagrid
fields={viewSchema.list.boxes}
indexField="position"
rowActionButtons={<SchemaButtons isList />}
rowSx={(record) => (record.stock === 0 ? {opacity: 0.6} : {})}
/>

SchemaDatagrid props​

NameTypeDefaultDescription
fieldsFieldDescriptor[]fields from the method schemaWhich columns to render, in order
expandReactElement | FC—Expandable row content
targetstring—Marks this list as the origin, so a row action can return to it
indexFieldstring—Field holding the order; enables drag-and-drop sorting
sortForFiltersFilters—Filters under which drag-and-drop ordering is allowed
onRowClick(record: HabRecord) => void—Replaces the default row activation
rowActionButtonsReactNode | falseschema actionsButtons in the row action column; false removes the column
rowSx(record: HabRecord) => SxProps—Per-row styling, e.g. to mark a state
singleClickActionActionDescriptorfrom the view schemaWhat a single click does
doubleClickActionActionDescriptorfrom the view schemaWhat a double click does
disableSortbooleanfalseTurns off column sorting
caution

Drag-and-drop ordering needs both indexField and a sort that matches the stored order. That is what sortForFilters guards: reordering rows while the list is sorted by something else would write positions the user cannot see.

Row tooltips​

A row whose click does something announces it: hovering shows a tooltip naming the available gesture and action — "Click: Show", "Double-click: Edit" — taken from the action's label in the record's own schema.

SchemaDatagrid builds that tooltip from singleClickAction / doubleClickAction, so a list with row activation gets it without any configuration. The schema-free AdminDatagrid underneath takes it as a prop:

NameTypeDefaultDescription
rowTooltip(record: RaRecord) => ReactNodeschema-driven in SchemaDatagridOverrides the tooltip; return null for rows that should have none

The tooltip appears after TOOLTIP_ENTER_DELAY and is suppressed while the pointer is over an interactive element inside the row — a button or a link — so the row hint never covers a control's own tooltip. Rows with neither click slot active get no tooltip at all.

To drop the tooltip from every list of the application, pass rowTooltip={false} to SchemaAdmin. Clicking and double-clicking a row still open it; only the hover hint goes away.

<SchemaAdmin
serviceConfigMap={serviceConfigMap}
authProvider={authProvider}
defaultRowAction="double-click"
rowTooltip={false}
/>

DatagridConfigurable and SelectColumnsButton​

DatagridConfigurable is the datagrid whose visible columns the user can choose; SelectColumnsButton is the control that opens the chooser. They belong together — the button does nothing without the configurable datagrid.

In generated lists this is switched on by columnSelector on SchemaAdmin, and the choice is stored per user through the preferences store.

See also​