’动态添加列后、固定列和普通table错位问题‘
This commit is contained in:
parent
46ccf18832
commit
7315c22181
|
@ -10805,8 +10805,7 @@
|
|||
if (nextProps.columns && nextProps.columns !== this.props.columns) {
|
||||
this.columnManager.reset(nextProps.columns);
|
||||
if (nextProps.columns.length !== this.props.columns.length && this.refs && this.refs.bodyTable) {
|
||||
this.refs.fixedColumnsBodyLeft && (this.refs.fixedColumnsBodyLeft.scrollTop = this.refs.bodyTable.scrollTop);
|
||||
this.refs.fixedColumnsBodyRight && (this.refs.fixedColumnsBodyRight.scrollTop = this.refs.bodyTable.scrollTop);
|
||||
this.scrollTop = this.refs.bodyTable.scrollTop;
|
||||
}
|
||||
} else if (nextProps.children !== this.props.children) {
|
||||
this.columnManager.reset(null, nextProps.children);
|
||||
|
@ -10825,6 +10824,11 @@
|
|||
if (typeof this.props.scroll.x !== 'number' && this.contentTable.getBoundingClientRect().width !== this.contentDomWidth) {
|
||||
this.computeTableWidth();
|
||||
}
|
||||
if (this.scrollTop) {
|
||||
this.refs.fixedColumnsBodyLeft && (this.refs.fixedColumnsBodyLeft.scrollTop = this.scrollTop);
|
||||
this.refs.fixedColumnsBodyRight && (this.refs.fixedColumnsBodyRight.scrollTop = this.scrollTop);
|
||||
this.scrollTop = 0;
|
||||
}
|
||||
};
|
||||
|
||||
Table.prototype.componentWillUnmount = function componentWillUnmount() {
|
||||
|
|
File diff suppressed because one or more lines are too long
10
src/Table.js
10
src/Table.js
|
@ -158,9 +158,8 @@ class Table extends Component {
|
|||
if (nextProps.columns && nextProps.columns !== this.props.columns) {
|
||||
this.columnManager.reset(nextProps.columns);
|
||||
if(nextProps.columns.length !== this.props.columns.length && this.refs && this.refs.bodyTable){
|
||||
this.refs.fixedColumnsBodyLeft && ( this.refs.fixedColumnsBodyLeft.scrollTop = this.refs.bodyTable.scrollTop);
|
||||
this.refs.fixedColumnsBodyRight && ( this.refs.fixedColumnsBodyRight.scrollTop = this.refs.bodyTable.scrollTop);
|
||||
}
|
||||
this.scrollTop = this.refs.bodyTable.scrollTop;
|
||||
}
|
||||
|
||||
} else if (nextProps.children !== this.props.children) {
|
||||
this.columnManager.reset(null, nextProps.children);
|
||||
|
@ -180,6 +179,11 @@ class Table extends Component {
|
|||
if (typeof (this.props.scroll.x) !== 'number' && this.contentTable.getBoundingClientRect().width !== this.contentDomWidth) {
|
||||
this.computeTableWidth();
|
||||
}
|
||||
if(this.scrollTop){
|
||||
this.refs.fixedColumnsBodyLeft && ( this.refs.fixedColumnsBodyLeft.scrollTop = this.scrollTop);
|
||||
this.refs.fixedColumnsBodyRight && ( this.refs.fixedColumnsBodyRight.scrollTop = this.scrollTop);
|
||||
this.scrollTop = 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue