Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table: fix expand-row-keys not work when data is loaded asynchronously #16899

Merged
merged 2 commits into from
Aug 29, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions packages/table/src/store/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ export default {
return {
states: {
// defaultExpandAll 存在于 expand.js 中,这里不重复添加
// TODO: 拆分为独立的 TreeTale,在 expand 中,展开行的记录是放在 expandRows 中,统一用法
// 在展开行中,expandRowKeys 会被转化成 expandRows,expandRowKeys 这个属性只是记录了 TreeTable 行的展开
// TODO: 拆分为独立的 TreeTable,统一用法
expandRowKeys: [],
treeData: {},
indent: 16,
Expand Down Expand Up @@ -52,8 +53,6 @@ export default {

watch: {
normalizedData: 'updateTreeData',
// expandRowKeys 在 TreeTable 中也有使用
expandRowKeys: 'updateTreeData',
normalizedLazyNode: 'updateTreeData'
},

Expand Down Expand Up @@ -153,11 +152,8 @@ export default {
},

updateTreeExpandKeys(value) {
// 仅仅在包含嵌套数据时才去更新
if (Object.keys(this.normalizedData).length) {
this.states.expandRowKeys = value;
this.updateTreeData();
}
this.states.expandRowKeys = value;
this.updateTreeData();
},

toggleTreeExpansion(row, expanded) {
Expand Down