# ChildGridConfig (@salmonui/data-grid/engine)

> The ChildGridConfig interface of @salmonui/data-grid/engine: 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).

Canonical: https://salmonui.dev/docs/reference/data-grid/engine/ChildGridConfig

```ts
import type { ChildGridConfig } from '@salmonui/data-grid/engine';
```

Also exported from `@salmonui/data-grid/engine/hierarchy`.

Entry index: https://salmonui.dev/docs/reference/data-grid/engine (Markdown with every symbol of the entry: https://salmonui.dev/docs/reference/data-grid/engine.md).

## Reference

Kind: interface

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

Members (8):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `relationField` | `readonly relationField?: string;` | optional | Field present in both parent and child rows. |
| `parentField` | `readonly parentField?: string;` | optional | Parent field whose value selects the children. Default `relationField`. |
| `childField` | `readonly childField?: string;` | optional | Child field compared with the parent value. Default `relationField`. |
| `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. |
| `getRowId` | `readonly getRowId?: (row: Child, index: number) => RowId;` | optional | Default: the value of the child column marked `primaryKey`, as a string. |
| `columns` | `readonly columns?: readonly ColumnDef<Child>[];` | optional |  |
| `options` | `readonly options?: Partial<DataGridOptions<Child>>;` | optional | Further child grid options (modules are the renderer's). |
| `childGrid` | `readonly childGrid?: ChildGridConfig<Nested, Child>;` | optional | Next nesting level. |
