API reference: @salmonui/data-grid
DataGridTreeinterface
import type { DataGridTree } from '@salmonui/data-grid';interface DataGridTree<Row = unknown> {
readonly childrenField?: string;
readonly parentIdField?: string;
readonly hasChildrenField?: string;
readonly expandedField?: string;
readonly column?: string;
readonly defaultExpanded?: boolean | number;
readonly expandedRows?: Readonly<Record<RowId, boolean>>;
readonly filterMode?: DataGridTreeFilterMode;
readonly pageBy?: 'all' | 'root';
readonly checkbox?: boolean | {
readonly cascade?: boolean | 'filtered';
};
readonly copyMode?: DataGridTreeFilterMode;
readonly loadChildren?: (ctx: DataGridTreeLoadContext<Row>) => readonly Row[] | Promise<readonly Row[]>;
}
tree prop (true: { childrenField: 'children' }).
| Name | Signature | Description |
|---|---|---|
childrenFieldoptional | readonly childrenField?: string; | Nested rows: the field holding child arrays. Default |
parentIdFieldoptional | readonly parentIdField?: string; | Flat self-referential rows: the field holding the parent's row id ( |
hasChildrenFieldoptional | readonly hasChildrenField?: string; | Rows whose children load on demand ( |
expandedFieldoptional | readonly expandedField?: string; | Initial expansion from a boolean data field ( |
columnoptional | readonly column?: string; | Field or column id of the tree column ( |
defaultExpandedoptional | readonly defaultExpanded?: boolean | number; |
|
expandedRowsoptional | readonly expandedRows?: Readonly<Record<RowId, boolean>>; | Salmon: reactive expansion overrides over |
filterModeoptional | readonly filterMode?: DataGridTreeFilterMode; | Rows a filter or search keeps ( |
pageByoptional | readonly pageBy?: 'all' | 'root'; | Paging counts every visible row (default) or root rows with their subtrees ( |
checkboxoptional | readonly checkbox?: boolean | {
readonly cascade?: boolean | 'filtered';
}; | Checkbox in the tree column (column |
copyModeoptional | readonly copyMode?: DataGridTreeFilterMode; | Rows |
loadChildrenoptional | readonly loadChildren?: (ctx: DataGridTreeLoadContext<Row>) => readonly Row[] | Promise<readonly Row[]>; | Loads the children of a lazy row ( |