API reference: @salmonui/data-grid/engine
ChildGridConfiginterface
import type { ChildGridConfig } from '@salmonui/data-grid/engine';Also exported from @salmonui/data-grid/engine/hierarchy.
interface ChildGridConfig<Child = unknown, Parent = unknown, Nested = unknown> {
readonly relationField?: string;
readonly parentField?: string;
readonly childField?: string;
readonly data: readonly Child[] | DataSource<Child> | ((parent: ChildGridParent<Parent>) => readonly Child[] | DataSource<Child>);
readonly getRowId?: (row: Child, index: number) => RowId;
readonly columns?: readonly ColumnDef<Child>[];
readonly options?: Partial<DataGridOptions<Child>>;
readonly childGrid?: ChildGridConfig<Nested, Child>;
}
One child grid level. Child is the child row type, Parent the row type
of the grid it nests in, and Nested the row type of the next level
(childGrid).
| Name | Signature | Description |
|---|---|---|
relationFieldoptional | readonly relationField?: string; | Field present in both parent and child rows. |
parentFieldoptional | readonly parentField?: string; | Parent field whose value selects the children. Default |
childFieldoptional | readonly childField?: string; | Child field compared with the parent value. Default |
data | readonly data: readonly Child[] | DataSource<Child> | ((parent: ChildGridParent<Parent>) => readonly Child[] | DataSource<Child>); | Child rows: one array shared by every parent (indexed once by relation key), a data source (local sources are indexed, remote and live sources receive the relation filter), or a factory per parent. |
getRowIdoptional | readonly getRowId?: (row: Child, index: number) => RowId; | Default: the value of the child column marked |
columnsoptional | readonly columns?: readonly ColumnDef<Child>[]; | |
optionsoptional | readonly options?: Partial<DataGridOptions<Child>>; | Further child grid options (modules are the renderer's). |
childGridoptional | readonly childGrid?: ChildGridConfig<Nested, Child>; | Next nesting level. |