View as Markdown

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).

ChildGridConfig members (8)
NameSignatureDescription
relationFieldoptionalreadonly relationField?: string;

Field present in both parent and child rows.

parentFieldoptionalreadonly parentField?: string;

Parent field whose value selects the children. Default relationField.

childFieldoptionalreadonly childField?: string;

Child field compared with the parent value. Default relationField.

datareadonly 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.

getRowIdoptionalreadonly getRowId?: (row: Child, index: number) => RowId;

Default: the value of the child column marked primaryKey, as a string.

columnsoptionalreadonly columns?: readonly ColumnDef<Child>[];
optionsoptionalreadonly options?: Partial<DataGridOptions<Child>>;

Further child grid options (modules are the renderer's).

childGridoptionalreadonly childGrid?: ChildGridConfig<Nested, Child>;

Next nesting level.