Skip to content

Commit

Permalink
Table:Fix hides the child nodes of the tree when new nodes are added …
Browse files Browse the repository at this point in the history
…[issues ElemeFE#14933]
  • Loading branch information
ax committed Apr 3, 2019
1 parent 8420952 commit adadda4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 5 additions & 3 deletions packages/table/src/table-body.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ export default {
const traverse = (children) => {
if (!children) return;
children.forEach(key => {
tmp.push(this.store.states.lazyTreeNodeMap[key]);
if (this.store.states.treeData[key]) {
traverse(this.store.states.treeData[key].children);
if (this.store.states.lazyTreeNodeMap[key]) {
tmp.push(this.store.states.lazyTreeNodeMap[key]);
if (this.store.states.treeData[key]) {
traverse(this.store.states.treeData[key].children);
}
}
});
};
Expand Down
5 changes: 2 additions & 3 deletions packages/table/src/table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@
const expanded = expandRowKeys.indexOf(rowKey) !== -1;
const treeNode = originData[rowKey] || {
children: [],
loaded: true,
loaded: false,
rowKey,
level,
display,
Expand All @@ -529,9 +529,8 @@
} else if (containChildren) {
traverse(item.children, treeNode, level + 1, display && expanded);
} else if (item.hasChildren && this.lazy) {
treeNode.loaded = false;
treeNode.hasChildren = true;
if (treeNode.expanded) {
if (treeNode.expanded && !treeNode.loaded) {
treeNode.expanded = false;
this.store.loadData(item, treeNode);
}
Expand Down

0 comments on commit adadda4

Please sign in to comment.