View as Markdown

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

buildTreeLayoutfunction

import { buildTreeLayout } from '@salmonui/data-grid/engine/tree';
function buildTreeLayout(parent: Int32Array, priority: Int32Array | null, keep: Uint8Array | null, base?: TreeLayout | null): TreeLayout;

Builds the pre-order of the rows kept by keep (null: every row). priority lists source indexes in sibling order (the sort stage's order; null: source order); kept rows missing from it follow in source order. Rows whose parent is not kept hang under the nearest kept ancestor (root when none). base, the source order layout of every row under parent (buildTreeLayout(parent, null, null)), makes a re-order or an ancestor closed filter (filterMode 'ancestors' / 'both') skip the tree walk. O(n).