fix(动态增加列后,固定表格和非固定列错位):

This commit is contained in:
wanghaoo 2018-10-25 09:52:00 +08:00
parent 7315c22181
commit 811c52e724
2 changed files with 7 additions and 3 deletions

View File

@ -237,8 +237,7 @@ var Table = function (_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);
@ -257,6 +256,11 @@ var Table = function (_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;
}
};
Table.prototype.componentWillUnmount = function componentWillUnmount() {

View File

@ -1,6 +1,6 @@
{
"name": "bee-table",
"version": "1.4.26",
"version": "1.4.27",
"description": "Table ui component for react",
"keywords": [
"react",