fix(tree): fix dynamic tree example and demo not closing children (#11148) #11728

This commit is contained in:
Victoria Wei
2018-06-19 15:55:07 -05:00
committed by GitHub
parent f31b2f4180
commit 128e2a0b04
2 changed files with 8 additions and 2 deletions
@@ -106,7 +106,10 @@ export class DynamicDataSource {
new DynamicFlatNode(name, node.level + 1, this.database.isExpandable(name)));
this.data.splice(index + 1, 0, ...nodes);
} else {
this.data.splice(index + 1, children.length);
let count = 0;
for (let i = index + 1; i < this.data.length
&& this.data[i].level > node.level; i++, count++) {}
this.data.splice(index + 1, count);
}
// notify the change
@@ -100,7 +100,10 @@ export class DynamicDataSource {
new DynamicFlatNode(name, node.level + 1, this.database.isExpandable(name)));
this.data.splice(index + 1, 0, ...nodes);
} else {
this.data.splice(index + 1, children.length);
let count = 0;
for (let i = index + 1; i < this.data.length
&& this.data[i].level > node.level; i++, count++) {}
this.data.splice(index + 1, count);
}
// notify the change