Skip to content

HierarchyContributor

Since v3.9.0

A plugin that contributes structure to the hierarchy.

Contributors never call each other: the HierarchyPlugin runs every attached contributor on each natural sibling list — structure contributors first (discover children, order siblings), then transform contributors (re-shape the list, e.g. insert group nodes).

PropertyTypeDescription
hierarchyStagestructure | transformstructure contributors run before transform contributors on every list.

Called once per row-model rebuild with the root rows. Return false to sit out this rebuild (e.g. the data is not a tree).

beginHierarchy(rows: readonly unknown[]): boolean
NameTypeDescription
rowsreadonly unknown[]

Re-shape one natural sibling list. Return the input array when nothing changes.

processSiblings(nodes: HierarchyNode[], context: HierarchySiblingContext): HierarchyNode[]
NameTypeDescription
nodesHierarchyNode[]
contextHierarchySiblingContext

Called once per rebuild (only if beginHierarchy returned true) with the flattened rows. positionOf returns a row’s final position — its depth can exceed the context.depth seen in processSiblings when a transform inserted levels above it.

Return false when this rebuild produced no structure from this contributor (e.g. no list was grouped). When every contributor returns false, the rows are announced as a flat grid — no treegrid role, no aria-level / aria-setsize / aria-posinset.

endHierarchy(rows: readonly unknown[], positionOf: (row: unknown) => HierarchyRowMeta | undefined): boolean
NameTypeDescription
rowsreadonly unknown[]
positionOf(row: unknown) => HierarchyRowMeta | undefined