mirror of https://github.com/ElemeFE/element
Table: fix expanded rows collapsing when data change (#9462)
parent
e40c17f68b
commit
cfa9e6fc61
|
@ -116,7 +116,7 @@ export default {
|
||||||
!this.fixed && this.layout.scrollY && this.layout.gutterWidth ? <td class="gutter" /> : ''
|
!this.fixed && this.layout.scrollY && this.layout.gutterWidth ? <td class="gutter" /> : ''
|
||||||
}
|
}
|
||||||
</tr>,
|
</tr>,
|
||||||
this.store.states.expandRows.indexOf(row) > -1
|
this.store.isRowExpanded(row)
|
||||||
? (<tr>
|
? (<tr>
|
||||||
<td colspan={ this.columns.length } class="el-table__expanded-cell">
|
<td colspan={ this.columns.length } class="el-table__expanded-cell">
|
||||||
{ this.table.renderExpanded ? this.table.renderExpanded(h, { row, $index, store: this.store }) : ''}
|
{ this.table.renderExpanded ? this.table.renderExpanded(h, { row, $index, store: this.store }) : ''}
|
||||||
|
|
|
@ -405,6 +405,15 @@ TableStore.prototype.toggleRowExpansion = function(row, expanded) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
TableStore.prototype.isRowExpanded = function(row) {
|
||||||
|
const { expandRows = [], rowKey } = this.states;
|
||||||
|
if (rowKey) {
|
||||||
|
const expandMap = getKeysMap(expandRows, rowKey);
|
||||||
|
return !!expandMap[getRowIdentity(row, rowKey)];
|
||||||
|
}
|
||||||
|
return expandRows.indexOf(row) !== -1;
|
||||||
|
};
|
||||||
|
|
||||||
TableStore.prototype.cleanSelection = function() {
|
TableStore.prototype.cleanSelection = function() {
|
||||||
const selection = this.states.selection || [];
|
const selection = this.states.selection || [];
|
||||||
const data = this.states.data;
|
const data = this.states.data;
|
||||||
|
|
Loading…
Reference in New Issue