View as Markdown

API reference: @salmonui/data-grid/engine/tree

parentsFromIdsfunction

import { parentsFromIds } from '@salmonui/data-grid/engine/tree';
function parentsFromIds(count: number, parentIdOf: (index: number) => string | null, indexOf: (id: string) => number, onIssue?: (issue: TreeIssue) => void): Int32Array;

Parents of flat self-referential rows. parentIdOf(i) returns row i's parent id (null for a root); indexOf resolves an id to a source index (-1 when unknown, through the engine id index). Unknown ids make the row an orphan root; a parent chain that loops is broken at the first repeated row, which becomes a root.