Expand and collapse API with events
Provides programmatic control over expansion: expand or collapse a node, expand all, collapse all, and expand to a given depth. It also emits before/after events, and the before event can cancel the change. Applications use this to drive toolbars and deep links.
Planned. This page shows the specification from issue #197. The live example, source for every framework and the API reference replace it when the feature ships.
Live example
A tree with 5 levels, all collapsed, with a toolbar and an event log panel.
Expected behavior
The buttons change expansion and the log records the events in order. When cancel is enabled, rows named Archive refuse to expand and log a cancelled event.
Planned API surface
expandRowcollapseRowtoggleRowexpandAllcollapseAllexpandToLevelisRowExpandedonRowExpandingonRowExpandedonRowCollapseddefaultExpandedLevelAcceptance criteria
- expandToLevel(n) expands exactly the levels below n (pending)
- onRowExpanding can prevent expansion by returning false or calling preventDefault (pending)
- expandAll on a 10,000-node tree is applied in a single render batch (pending)
- Expanding a hidden descendant optionally expands its ancestors (option: expandParents) (pending)
- Events include the row id, level and source (user/api) (pending)