I'm trying to recursively expand all nodes on a Primeng TreeTable component but without success. The row icons change and nothing more happens, except when i manualy click on the expand/colapse icon and all nodes are expanded/collapsed accordingly.
Here a stackbliz link for what i'm trying to do, Stackblitz code
And this are my expand/colapse methods:
public expandAll(): void {
this.files1.forEach(node => {
this.expandCollapseRecursive(node, true);
});
}
public collapseAll(): void {
this.files1.forEach(node => {
this.expandCollapseRecursive(node, false);
});
}
private expandCollapseRecursive(node: TreeNode, isExpand: boolean): void {
node.expanded = isExpand;
if (node.children) {
node.children.forEach(childNode => {
this.expandCollapseRecursive(childNode, isExpand);
});
}
}