View as Markdown

API reference: @salmonui/data-grid

DataGridTreeApiinterface

import type { DataGridTreeApi } from '@salmonui/data-grid';
interface DataGridTreeApi<Row> {
    expandAllTreeRows(): DataGridActionResult;
    collapseAllTreeRows(): DataGridActionResult;
    expandTreeLevel(depth: number): DataGridActionResult;
    collapseTreeLevel(depth: number): DataGridActionResult;
    expandTreeRows(rowIds: RowId | readonly RowId[]): DataGridActionResult;
    collapseTreeRows(rowIds: RowId | readonly RowId[]): DataGridActionResult;
    toggleTreeRow(rowId: RowId, expanded?: boolean): DataGridActionResult;
    indentRows(rowIds: RowId | readonly RowId[]): DataGridActionResult;
    outdentRows(rowIds: RowId | readonly RowId[]): DataGridActionResult;
    getTreeRow(rowId: RowId): DataGridTreeRowInfo | null;
    getChildRows(rowId: RowId | null): readonly Row[];
    reloadTreeChildren(rowId: RowId): DataGridActionResult;
    getVisibleRows(): readonly Row[];
}

Tree methods of DataGridApi (rejected or empty without tree).

DataGridTreeApi members (13)
NameSignatureDescription
expandAllTreeRowsexpandAllTreeRows(): DataGridActionResult;
collapseAllTreeRowscollapseAllTreeRows(): DataGridActionResult;
expandTreeLevelexpandTreeLevel(depth: number): DataGridActionResult;

Expands the parents at depth (0: roots).

collapseTreeLevelcollapseTreeLevel(depth: number): DataGridActionResult;
expandTreeRowsexpandTreeRows(rowIds: RowId | readonly RowId[]): DataGridActionResult;
collapseTreeRowscollapseTreeRows(rowIds: RowId | readonly RowId[]): DataGridActionResult;
toggleTreeRowtoggleTreeRow(rowId: RowId, expanded?: boolean): DataGridActionResult;
indentRowsindentRows(rowIds: RowId | readonly RowId[]): DataGridActionResult;

Moves rows under their previous sibling.

outdentRowsoutdentRows(rowIds: RowId | readonly RowId[]): DataGridActionResult;

Moves rows after their parent, as its siblings.

getTreeRowgetTreeRow(rowId: RowId): DataGridTreeRowInfo | null;
getChildRowsgetChildRows(rowId: RowId | null): readonly Row[];

Kept children of a row in view order (null: the roots).

reloadTreeChildrenreloadTreeChildren(rowId: RowId): DataGridActionResult;

Salmon: retries a failed lazy child load.

getVisibleRowsgetVisibleRows(): readonly Row[];

Visible data rows in view order.