From a6adc2be0d0a482893096aa1c2e91cc28c2f463a Mon Sep 17 00:00:00 2001 From: wanghaoo Date: Wed, 24 Oct 2018 21:59:54 +0800 Subject: [PATCH] feat: --- build/Table.js | 7 ++++--- package.json | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/build/Table.js b/build/Table.js index 1f9b49a..cc9fa3d 100644 --- a/build/Table.js +++ b/build/Table.js @@ -126,6 +126,7 @@ var defaultProps = { emptyText: function emptyText() { return 'No Data'; }, + columns: [], minColumnWidth: 80 }; @@ -235,9 +236,9 @@ var Table = function (_Component) { } if (nextProps.columns && nextProps.columns !== this.props.columns) { this.columnManager.reset(nextProps.columns); - if (this.refs && this.refs.bodyTable) { - //如果列变了,对应的table的ScrollTop属性置为0 - this.refs.bodyTable.scrollTop = 0; + if (nextProps.columns.length !== this.props.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); } } else if (nextProps.children !== this.props.children) { this.columnManager.reset(null, nextProps.children); diff --git a/package.json b/package.json index 81542e2..cd58dab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bee-table", - "version": "1.4.24", + "version": "1.4.25", "description": "Table ui component for react", "keywords": [ "react",