Collapse the data node and all its descendants. If it is already collapsed, does nothing.
(dataNode: T)
| 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 { |
no test coverage detected