Skip to main content
cngx-src documentation

sortTree

Functionutils/tree

projects/utils/tree.ts

Description#

Return a new tree where each level's siblings are sorted independently by the by extractor. Child ordering is stable within its own level only — the relative position of nodes across different parents is irrelevant.

Fresh implementation — not ported from @cngx/data-display/treetable.

Signature#

sortTree(nodes, by, direction)

Parameters#

@paramnodes
@paramby
@paramdirection= 'asc'

Returns#

CngxTreeNode[]