View as Markdown

API reference: @salmonui/data-grid

DataGridCellcomponent

import { DataGridCell } from '@salmonui/data-grid';
const DataGridCell: <Row>(props: DataGridCellProps<Row>) => ReactNode;

Body cell part. Subscribes to its own engine cell channel only, so a change to one cell re-renders one cell. memo (instead of compiler-derived memoization, the package is not compiled yet) keeps retained cells from re-rendering when a row re-renders for a column-window change.

Props: DataGridCellProps

DataGridCell props (9)
NameSignatureDescription
rowIdrowId: RowId;
columncolumn: CompiledColumn<Row>;
rowIndexrowIndex: number;
colIndexcolIndex: number;

1-based aria-colindex (display position among visible leaves).

colSpanoptionalcolSpan?: number;

Cell span: aria-colspan / aria-rowspan and the spanned width/height.

rowSpanoptionalrowSpan?: number;
spanStyleoptionalspanStyle?: CSSProperties | undefined;
spanAnchoroptionalspanAnchor?: boolean;

A row span whose first row is above the rendered window, drawn in the window's first row: the cell carries its own data-row-id so pointer, focus and context-menu targets resolve to the span's row.

renderKeyoptionalrenderKey?: number | undefined;

Render key of the column's render-only fields (renderCell, cellClassName, ...): changes when one of them changed without a recompile, so memo re-renders this column's cells only.