MCPcopy Index your code
hub / github.com/angular/components / collapseDescendants

Method collapseDescendants

src/cdk/tree/tree.ts:698–710  ·  view source on GitHub ↗

Collapse the data node and all its descendants. If it is already collapsed, does nothing.

(dataNode: T)

Source from the content-addressed store, hash-verified

696
697 /** Collapse the data node and all its descendants. If it is already collapsed, does nothing. */
698 collapseDescendants(dataNode: T): void {
699 if (this.treeControl) {
700 this.treeControl.collapseDescendants(dataNode);
701 } else if (this._expansionModel) {
702 const expansionModel = this._expansionModel;
703 expansionModel.deselect(this._getExpansionKey(dataNode));
704 this._getDescendants(dataNode)
705 .pipe(take(1), takeUntil(this._onDestroy))
706 .subscribe(children => {
707 expansionModel.deselect(...children.map(child => this._getExpansionKey(child)));
708 });
709 }
710 }
711
712 /** Expands all data nodes in the tree. */
713 expandAll(): void {

Callers 1

toggleDescendantsMethod · 0.95

Calls 4

_getExpansionKeyMethod · 0.95
_getDescendantsMethod · 0.95
collapseDescendantsMethod · 0.65
deselectMethod · 0.65

Tested by

no test coverage detected