We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 53830b0 commit 284a8feCopy full SHA for 284a8fe
src/material-examples/tree-dynamic/tree-dynamic-example.ts
@@ -94,13 +94,22 @@ export class DynamicDataSource {
94
95
node.isLoading = true;
96
97
+ let count = 0;
98
+
99
setTimeout(() => {
100
if (expand) {
101
const nodes = children.map(name =>
102
new DynamicFlatNode(name, node.level + 1, this.database.isExpandable(name)));
103
this.data.splice(index + 1, 0, ...nodes);
104
} else {
- this.data.splice(index + 1, children.length);
105
+ for (let i = index + 1; i < this.data.length; i++) {
106
+ if (this.data[i].level > node.level) {
107
+ count++;
108
+ } else {
109
+ break;
110
+ }
111
112
+ this.data.splice(index + 1, count);
113
}
114
115
// notify the change
0 commit comments