API reference: @salmonui/data-grid
DataGridChildGridinterface
import type { DataGridChildGrid } from '@salmonui/data-grid';interface DataGridChildGrid<Child = unknown, Parent = unknown> extends Omit<DataGridProps<Child>, 'data' | 'id' | 'ref' | 'children'> {
readonly data: readonly Child[] | DataSource<Child> | ((parent: DataGridChildGridParent<Parent>) => readonly Child[] | DataSource<Child>);
readonly joinField?: string;
readonly parentField?: string;
readonly childField?: string;
}
childGrid prop: every
DataGrid prop of the child, plus the child rows and the relation. The child
inherits locale, dir, timeZone, and currency unless set.
| Name | Signature | Description |
|---|---|---|
data | readonly data: readonly Child[] | DataSource<Child> | ((parent: DataGridChildGridParent<Parent>) => readonly Child[] | DataSource<Child>); | Child rows: one array shared by every parent (indexed once by the join value), a data source (remote sources receive the relation filter), or a factory per parent. |
joinFieldoptional | readonly joinField?: string; | Field present in parent and child rows. |
parentFieldoptional | readonly parentField?: string; | Parent field when the names differ. Default |
childFieldoptional | readonly childField?: string; | Child field when the names differ. Default |
pinnedColumnsoptionalinherited | pinnedColumns?: DataGridPinnedColumns; | The first / last N visible columns are pinned. Reactive. |
stickyRowsoptionalinherited | stickyRows?: number; | The first N rows of the visible row model stick below the header. |
stickyBottomRowsoptionalinherited | stickyBottomRows?: number; | The last N rows of the visible row model stick above the footer. |
onBeforeColumnPinChangeoptionalinherited | onBeforeColumnPinChange?: ((event: DataGridColumnPinChangeEvent) => void); | |
onColumnPinChangeoptionalinherited | onColumnPinChange?: ((event: DataGridColumnPinChangeEvent) => void); | |
mergeCellsoptionalinherited | mergeCells?: DataGridMergeCells; | DataGrid-wide merging of equal adjacent values (row merging also works under row virtualization). |
columnMenuoptionalinherited | columnMenu?: boolean | readonly (DataGridMenuItem | DataGridColumnMenuItemId)[]; | Column menu; an array lists the items in order (built-in ids or custom items). |
onBeforeColumnMenuOpenoptionalinherited | onBeforeColumnMenuOpen?: ((event: DataGridColumnMenuOpenEvent<Child>) => void); | |
onBeforeColumnMenuCloseoptionalinherited | onBeforeColumnMenuClose?: ((event: DataGridColumnMenuCloseEvent<Child>) => void); | |
onColumnMenuItemClickoptionalinherited | onColumnMenuItemClick?: ((event: DataGridColumnMenuItemClickEvent<Child>) => void); | |
renderColumnMenuoptionalinherited | renderColumnMenu?: ((ctx: DataGridColumnMenuContext<Child>) => ReactNode); | |
columnChooseroptionalinherited | columnChooser?: boolean | DataGridColumnChooser<Child>; | |
onBeforeColumnChooserOpenoptionalinherited | onBeforeColumnChooserOpen?: ((event: DataGridColumnChooserOpenEvent<Child>) => void); | |
toolbaroptionalinherited | toolbar?: readonly (DataGridToolbarItem | DataGridToolbarItemId)[]; | |
onToolbarItemClickoptionalinherited | onToolbarItemClick?: ((event: DataGridToolbarItemClickEvent) => void); | |
renderToolbaroptionalinherited | renderToolbar?: ((ctx: DataGridToolbarContext<Child>) => ReactNode); | |
contextMenuoptionalinherited | contextMenu?: boolean | readonly (DataGridMenuItem | DataGridContextMenuItemId)[]; | Context menu; an array lists the items in order. Items that do not apply to the target are dropped. |
onBeforeContextMenuOpenoptionalinherited | onBeforeContextMenuOpen?: ((event: DataGridContextMenuOpenEvent) => void); | |
onBeforeContextMenuCloseoptionalinherited | onBeforeContextMenuClose?: ((event: DataGridContextMenuCloseEvent) => void); | |
onContextMenuItemClickoptionalinherited | onContextMenuItemClick?: ((event: DataGridContextMenuItemClickEvent<Child>) => void); | |
renderContextMenuoptionalinherited | renderContextMenu?: ((ctx: DataGridContextMenuContext) => ReactNode); | |
onColumnResizeStartoptionalinherited | onColumnResizeStart?: ((event: DataGridColumnResizeEvent) => void); | |
onColumnResizeoptionalinherited | onColumnResize?: ((event: DataGridColumnResizeEvent) => void); | |
onColumnResizeEndoptionalinherited | onColumnResizeEnd?: ((event: DataGridColumnResizeEvent) => void); | |
onColumnDragStartoptionalinherited | onColumnDragStart?: ((event: DataGridColumnDragEvent) => void); | |
onColumnDragoptionalinherited | onColumnDrag?: ((event: DataGridColumnDragEvent) => void); | |
onColumnDropoptionalinherited | onColumnDrop?: ((event: DataGridColumnDragEvent) => void); | |
adaptiveoptionalinherited | adaptive?: boolean | DataGridAdaptive; | Adaptive UI ( |
onBeforeAdaptiveDialogOpenoptionalinherited | onBeforeAdaptiveDialogOpen?: ((event: DataGridAdaptiveDialogOpenEvent) => void); | |
onBeforeCopyoptionalinherited | onBeforeCopy?: ((event: DataGridBeforeCopyEvent) => void); | |
onBeforePasteoptionalinherited | onBeforePaste?: ((event: DataGridBeforePasteEvent) => void); | |
onBeforeFilloptionalinherited | onBeforeFill?: ((event: DataGridBeforeFillEvent) => void); | |
editingoptionalinherited | editing?: boolean | DataGridEditing<Child>; | Editing. |
onBeforeEditStartoptionalinherited | onBeforeEditStart?: ((event: DataGridEditStartEvent<Child>) => void); | |
onEditStartoptionalinherited | onEditStart?: ((event: DataGridEditStartEvent<Child>) => void); | |
onBeforeCellValueChangeoptionalinherited | onBeforeCellValueChange?: ((event: DataGridCellValueChangeEvent) => void); | |
onCellValueChangeoptionalinherited | onCellValueChange?: ((event: DataGridCellValueChangeEvent) => void); | |
onBeforeSaveoptionalinherited | onBeforeSave?: ((event: DataGridSaveEvent<Child>) => void); | |
onSaveoptionalinherited | onSave?: ((event: DataGridSaveEvent<Child>) => void); | |
onBeforeAddoptionalinherited | onBeforeAdd?: ((event: DataGridAddEvent<Child>) => void); | |
onAddoptionalinherited | onAdd?: ((event: DataGridAddEvent<Child>) => void); | |
onBeforeDeleteoptionalinherited | onBeforeDelete?: ((event: DataGridDeleteEvent<Child>) => void); | |
onDeleteoptionalinherited | onDelete?: ((event: DataGridDeleteEvent<Child>) => void); | |
onBeforeEditCanceloptionalinherited | onBeforeEditCancel?: ((event: DataGridEditCancelEvent) => void); | |
onEditCanceloptionalinherited | onEditCancel?: ((event: DataGridEditCancelEvent) => void); | |
onCommandClickoptionalinherited | onCommandClick?: ((event: DataGridCommandClickEvent<Child>) => void); | |
sortingoptionalinherited | sorting?: boolean | DataGridSorting; |
|
filteringoptionalinherited | filtering?: boolean | DataGridFiltering; |
|
searchoptionalinherited | search?: boolean | DataGridSearch; |
|
pagingoptionalinherited | paging?: boolean | DataGridPaging; |
|
renderPageroptionalinherited | renderPager?: ((ctx: DataGridPagerContext) => ReactNode); | Replaces the pager. |
onBeforeSortChangeoptionalinherited | onBeforeSortChange?: ((event: DataGridSortChangeEvent) => void); | |
onSortChangeoptionalinherited | onSortChange?: ((event: DataGridSortChangeEvent) => void); | |
onBeforeFilterChangeoptionalinherited | onBeforeFilterChange?: ((event: DataGridFilterChangeEvent) => void); | |
onFilterChangeoptionalinherited | onFilterChange?: ((event: DataGridFilterChangeEvent) => void); | |
onBeforeFilterMenuOpenoptionalinherited | onBeforeFilterMenuOpen?: ((event: DataGridFilterMenuOpenEvent) => void); | |
onFilterMenuOpenoptionalinherited | onFilterMenuOpen?: ((event: DataGridFilterMenuOpenEvent) => void); | |
onBeforeSearchChangeoptionalinherited | onBeforeSearchChange?: ((event: DataGridSearchChangeEvent) => void); | |
onSearchChangeoptionalinherited | onSearchChange?: ((event: DataGridSearchChangeEvent) => void); | |
onBeforePageChangeoptionalinherited | onBeforePageChange?: ((event: DataGridPageChangeEvent) => void); | |
onPageChangeoptionalinherited | onPageChange?: ((event: DataGridPageChangeEvent) => void); | |
onErroroptionalinherited | onError?: ((event: DataGridErrorEvent) => void); | An action was rejected (unknown column, page out of range, ...). |
renderDetailoptionalinherited | renderDetail?: ((ctx: DataGridDetailContext<Child>) => ReactNode); | Detail row content below each expanded row. |
detailHeightoptionalinherited | detailHeight?: number; | Estimated detail row height in px before measurement. Default 150. |
hasDetailoptionalinherited | hasDetail?: ((row: Child) => boolean); | Rows without a detail (no toggle). Called for rendered rows only. |
loadDetailoptionalinherited | loadDetail?: ((ctx: DataGridDetailLoadContext<Child>) => unknown); | Async detail content, started on expand; |
defaultExpandedDetailsoptionalinherited | defaultExpandedDetails?: boolean | readonly string[]; | Initially expanded details: |
childGridoptionalinherited | childGrid?: DataGridChildGrid<unknown, Child>; | Child grid inside each expanded row (hierarchy grid). An inline object
sees child rows as |
onBeforeDetailToggleoptionalinherited | onBeforeDetailToggle?: ((event: DataGridDetailToggleEvent<Child>) => void); | |
onDetailToggleoptionalinherited | onDetailToggle?: ((event: DataGridDetailToggleEvent<Child>) => void); | |
rowDragoptionalinherited | rowDrag?: boolean | DataGridRowDrag; | Row drag and drop with a drag handle column; |
onRowDragStartoptionalinherited | onRowDragStart?: ((event: DataGridRowDragEvent<Child>) => void); | Cancel with |
onRowDragoptionalinherited | onRowDrag?: ((event: DataGridRowDragEvent<Child>) => void); | Once per animation frame while dragging. |
onBeforeRowDropoptionalinherited | onBeforeRowDrop?: ((event: DataGridRowDragEvent<Child>) => void); | Cancel with |
onRowDropoptionalinherited | onRowDrop?: ((event: DataGridRowDragEvent<Child>) => void); | |
renderRowDragPreviewoptionalinherited | renderRowDragPreview?: ((ctx: DataGridRowDragPreviewContext<Child>) => ReactNode); | Drag preview content (default: the first cell text and the row count). |
exportWritersoptionalinherited | exportWriters?: DataGridExportWriters; | Excel and PDF writer loaders; without one the matching toolbar and menu items are disabled. |
onBeforeExportoptionalinherited | onBeforeExport?: ((event: DataGridBeforeExportEvent<Child>) => void); | |
onExportoptionalinherited | onExport?: ((event: DataGridExportEvent<Child>) => void); | |
printingoptionalinherited | printing?: DataGridPrinting<Child>; | Print scope and hierarchy mode ( |
onBeforePrintoptionalinherited | onBeforePrint?: ((event: DataGridBeforePrintEvent) => void); | |
onAfterPrintoptionalinherited | onAfterPrint?: ((event: DataGridAfterPrintEvent) => void); | |
loadingIndicatoroptionalinherited | loadingIndicator?: "skeleton" | "spinner"; | Built-in loading indicator. Default |
renderLoadingoptionalinherited | renderLoading?: ((ctx: DataGridLoadingContext) => ReactNode); | Replaces the content of the loading indicator (presentational: the grid announces loading itself). |
onRowClickoptionalinherited | onRowClick?: ((event: DataGridRowClickEvent<Child>) => void); | A data row was clicked. |
onRowDoubleClickoptionalinherited | onRowDoubleClick?: ((event: DataGridRowClickEvent<Child>) => void); | A data row was double-clicked. |
onCellClickoptionalinherited | onCellClick?: ((event: DataGridCellClickEvent<Child>) => void); | A cell of a data row was clicked; fires before |
onCellDoubleClickoptionalinherited | onCellDoubleClick?: ((event: DataGridCellClickEvent<Child>) => void); | A cell of a data row was double-clicked; fires before |
recordCommandsoptionalinherited | recordCommands?: boolean; | Keeps a serializable log of applied commands ( |
instrumentoptionalinherited | instrument?: boolean; | Exposes store counters ( |
treeoptionalinherited | tree?: boolean | DataGridTree<Child>; | Tree mode: rows with children, indented in the tree column. Read at creation (its options are reactive). |
onBeforeTreeToggleoptionalinherited | onBeforeTreeToggle?: ((event: DataGridTreeToggleEvent<Child>) => void); | |
onTreeToggleoptionalinherited | onTreeToggle?: ((event: DataGridTreeToggleEvent<Child>) => void); | |
isRowPinnedoptionalinherited | isRowPinned?: ((row: Child) => boolean); | Rows pinned to the top zone. Pinned rows stay
visible above the scrolling rows on every page, are left out of
|
defaultPinnedRowsoptionalinherited | defaultPinnedRows?: readonly string[]; | Initially pinned row ids (initial only). Turns row pinning on; pass |
onBeforeFilterBuilderOpenoptionalinherited | onBeforeFilterBuilderOpen?: ((event: DataGridFilterBuilderOpenEvent) => void); | |
columnsoptionalinherited | columns?: readonly DataGridColumn<Child>[]; | Column definitions; |
getRowIdoptionalinherited | getRowId?: ((row: Child) => string | number); | Row identity. Default: the |
modulesoptionalinherited | modules?: readonly DataGridModule<Child, unknown, DataGridCommand, string, {}>[]; | Extra core modules (initial only). |
featuresoptionalinherited | features?: readonly DataGridFeature[]; | Salmon. Render features to use
synchronously, from |
localeoptionalinherited | locale?: string; | |
timeZoneoptionalinherited | timeZone?: string; | IANA time zone for date formatting. Set it for SSR: server and client must format identically. |
currencyoptionalinherited | currency?: string; | |
diroptionalinherited | dir?: "auto" | "ltr" | "rtl"; | Text direction. |
heightoptionalinherited | height?: string | number; | Viewport height: px, any CSS length ( |
widthoptionalinherited | width?: string | number; | |
rowHeightoptionalinherited | rowHeight?: number; | Fixed row height in px. Default 36. |
getRowHeightoptionalinherited | getRowHeight?: ((row: Child) => number); | Per-row fixed height. |
estimatedRowHeightoptionalinherited | estimatedRowHeight?: number; | Enables measured row heights with this estimate (variable content, templates, wrapping). |
headerHeightoptionalinherited | headerHeight?: number; | Header row height in px (per stacked level). Default 40. |
defaultColumnWidthoptionalinherited | defaultColumnWidth?: number; | Width of columns without |
virtualizationoptionalinherited | virtualization?: boolean | DataGridVirtualization; | Row and column virtualization; |
infiniteScrolloptionalinherited | infiniteScroll?: boolean | DataGridInfiniteScroll<Child>; | Infinite scrolling for remote sources: rows load in blocks as the viewport approaches them. |
renderLoadingRowoptionalinherited | renderLoadingRow?: ((ctx: DataGridLoadingRowContext) => ReactNode); | Placeholder row while its block loads, or after the load failed. Default: the loading text, or the error and a Retry button. |
initialRowsoptionalinherited | initialRows?: number; | Rows in the deterministic server/initial range. Default 20. |
initialColumnsoptionalinherited | initialColumns?: number; | Center columns in the deterministic server/initial range. Default 20. |
textWrapoptionalinherited | textWrap?: DataGridTextWrap; | |
gridLinesoptionalinherited | gridLines?: DataGridLines; | |
overflowoptionalinherited | overflow?: DataGridOverflow; | Default text overflow of every column. Default |
highlightOnHoveroptionalinherited | highlightOnHover?: boolean; | Row hover highlight. Default true. |
stripedoptionalinherited | striped?: boolean; | Alternate row shading. Default true. |
resizableoptionalinherited | resizable?: boolean; | Pointer and keyboard column resize. Default false; column |
resizeModeoptionalinherited | resizeMode?: "auto" | "normal"; | Column fit. |
reorderableoptionalinherited | reorderable?: boolean; | Pointer and keyboard column reorder. Default false; column |
onBeforeColumnVisibilityChangeoptionalinherited | onBeforeColumnVisibilityChange?: ((event: DataGridColumnVisibilityChangeEvent) => void); | |
onColumnVisibilityChangeoptionalinherited | onColumnVisibilityChange?: ((event: DataGridColumnVisibilityChangeEvent) => void); | |
onBeforeColumnReorderoptionalinherited | onBeforeColumnReorder?: ((event: DataGridColumnReorderEvent) => void); | |
onColumnReorderoptionalinherited | onColumnReorder?: ((event: DataGridColumnReorderEvent) => void); | |
groupingoptionalinherited | grouping?: boolean | DataGridGrouping<Child>; |
|
onBeforeGroupChangeoptionalinherited | onBeforeGroupChange?: ((event: DataGridGroupChangeEvent) => void); | |
onGroupChangeoptionalinherited | onGroupChange?: ((event: DataGridGroupChangeEvent) => void); | |
onBeforeGroupToggleoptionalinherited | onBeforeGroupToggle?: ((event: DataGridGroupToggleEvent<Child>) => void); | |
onGroupToggleoptionalinherited | onGroupToggle?: ((event: DataGridGroupToggleEvent<Child>) => void); | |
aggregatesoptionalinherited | aggregates?: readonly DataGridAggregateRow<Child>[]; | Aggregate rows (or |
aggregateScopeoptionalinherited | aggregateScope?: "all" | "page"; | With paging: |
renderRowoptionalinherited | renderRow?: ((ctx: DataGridRowContext<Child>) => ReactNode); | |
renderEmptyoptionalinherited | renderEmpty?: ((ctx: DataGridEmptyContext) => ReactNode); | |
renderErroroptionalinherited | renderError?: ((ctx: DataGridDataErrorContext) => ReactNode); | Body content while the data source failed to load. Default: the error message and a Retry button. |
onViewChangeoptionalinherited | onViewChange?: ((event: DataGridViewChangeEvent) => void); | Once per committed change of the displayed rows; never on scroll, focus, selection, or expansion. |
getRowPropsoptionalinherited | getRowProps?: ((row: Child, rowIndex: number, ctx: { readonly tree?: DataGridTreeContext; }) => DataGridElementProps | undefined); | Called for rendered rows only; |
rowClassNameoptionalinherited | rowClassName?: ((row: Child, rowIndex: number) => string | undefined); | |
getCellPropsoptionalinherited | getCellProps?: ((ctx: DataGridCellContext<Child>) => DataGridElementProps | undefined); | Called for rendered cells only. |
classNameoptionalinherited | className?: string; | |
styleoptionalinherited | style?: CSSProperties; | |
classNamesoptionalinherited | classNames?: Partial<Record<DataGridPart, string>>; | |
stylesoptionalinherited | styles?: Partial<Record<DataGridPart, CSSProperties>>; | |
iconsoptionalinherited | icons?: Partial<Record<DataGridIconName, ReactNode>>; | Icon overrides by name:
a node replaces the built-in SVG icon, |
aria-labeloptionalinherited | aria-label?: string; | |
aria-labelledbyoptionalinherited | aria-labelledby?: string; | |
aria-describedbyoptionalinherited | aria-describedby?: string; | |
onWarningoptionalinherited | onWarning?: ((warning: DataGridWarning) => void); | |
onReadyoptionalinherited | onReady?: ((api: DataGridApi<Child>) => void); | Fires once after the first commit with the instance. |
selectionoptionalinherited | selection?: boolean | DataGridSelection; | Selection. On by default: single row selection. |
onBeforeSelectionChangeoptionalinherited | onBeforeSelectionChange?: ((event: DataGridSelectionChangeEvent<Child>) => void); | Cancel with |
onSelectionChangeoptionalinherited | onSelectionChange?: ((event: DataGridSelectionChangeEvent<Child>) => void); | |
keyBindingsoptionalinherited | keyBindings?: Readonly<Record<string, readonly string[]>>; | Replaces the combos of keyboard commands ( |
onKeyDownoptionalinherited | onKeyDown?: ((ctx: DataGridKeyDownContext) => void); | Called for every key pressed in the grid before the built-in binding runs. |
localeTextoptionalinherited | localeText?: DataGridLocaleText; | Text overrides over the English catalog ( |
persistStateoptionalinherited | persistState?: boolean | DataGridPersistState; | Saves the user's grid state (column order, widths, visibility, pinning,
sorting, filters, grouping, page, search, selection, scroll) and restores
it on mount. |