View as Markdown

API reference: @salmonui/data-grid

DataGridDetailPropsinterface

import type { DataGridDetailProps } from '@salmonui/data-grid';
interface DataGridDetailProps<Row> {
    renderDetail?: (ctx: DataGridDetailContext<Row>) => ReactNode;
    detailHeight?: number;
    hasDetail?: (row: Row) => boolean;
    loadDetail?: (ctx: DataGridDetailLoadContext<Row>) => unknown;
    defaultExpandedDetails?: boolean | readonly RowId[];
    childGrid?: DataGridChildGrid<unknown, Row>;
    onBeforeDetailToggle?: (event: DataGridDetailToggleEvent<Row>) => void;
    onDetailToggle?: (event: DataGridDetailToggleEvent<Row>) => void;
    rowDrag?: boolean | DataGridRowDrag;
    onRowDragStart?: (event: DataGridRowDragEvent<Row>) => void;
    onRowDrag?: (event: DataGridRowDragEvent<Row>) => void;
    onBeforeRowDrop?: (event: DataGridRowDragEvent<Row>) => void;
    onRowDrop?: (event: DataGridRowDragEvent<Row>) => void;
    renderRowDragPreview?: (ctx: DataGridRowDragPreviewContext<Row>) => ReactNode;
}
DataGridDetailProps members (14)
NameSignatureDescription
renderDetailoptionalrenderDetail?: (ctx: DataGridDetailContext<Row>) => ReactNode;

Detail row content below each expanded row.

detailHeightoptionaldetailHeight?: number;

Estimated detail row height in px before measurement. Default 150.

hasDetailoptionalhasDetail?: (row: Row) => boolean;

Rows without a detail (no toggle). Called for rendered rows only.

loadDetailoptionalloadDetail?: (ctx: DataGridDetailLoadContext<Row>) => unknown;

Async detail content, started on expand; renderDetail receives status, data, error.

defaultExpandedDetailsoptionaldefaultExpandedDetails?: boolean | readonly RowId[];

Initially expanded details: true for every row, or row ids (initial only).

childGridoptionalchildGrid?: DataGridChildGrid<unknown, Row>;

Child grid inside each expanded row (hierarchy grid). An inline object sees child rows as unknown; defineChildGrid<Child, Parent>(config) types the child rows.

onBeforeDetailToggleoptionalonBeforeDetailToggle?: (event: DataGridDetailToggleEvent<Row>) => void;
onDetailToggleoptionalonDetailToggle?: (event: DataGridDetailToggleEvent<Row>) => void;
rowDragoptionalrowDrag?: boolean | DataGridRowDrag;

Row drag and drop with a drag handle column; true reorders within the grid.

onRowDragStartoptionalonRowDragStart?: (event: DataGridRowDragEvent<Row>) => void;

Cancel with event.preventDefault().

onRowDragoptionalonRowDrag?: (event: DataGridRowDragEvent<Row>) => void;

Once per animation frame while dragging.

onBeforeRowDropoptionalonBeforeRowDrop?: (event: DataGridRowDragEvent<Row>) => void;

Cancel with event.preventDefault().

onRowDropoptionalonRowDrop?: (event: DataGridRowDragEvent<Row>) => void;
renderRowDragPreviewoptionalrenderRowDragPreview?: (ctx: DataGridRowDragPreviewContext<Row>) => ReactNode;

Drag preview content (default: the first cell text and the row count).