’columns宽度不同时重置scrollTop‘

This commit is contained in:
wanghaoo 2018-10-24 21:58:58 +08:00
parent ba8837b04c
commit 059414bfae
5 changed files with 1425 additions and 952 deletions

2
dist/demo.css vendored
View File

@ -8501,7 +8501,7 @@ ul {
.u-table-row-expand-icon, .u-table-expanded-row-expand-icon {
cursor: pointer;
display: inline-block;
margin-right: 10px;
margin-right: 0px;
width: 16px;
height: 16px;
text-align: center;

2
dist/demo.css.map vendored

File diff suppressed because one or more lines are too long

2363
dist/demo.js vendored

File diff suppressed because one or more lines are too long

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -68,6 +68,7 @@ const defaultProps = {
rowRef: () => null,
getBodyWrapper: body => body,
emptyText: () => 'No Data',
columns:[],
minColumnWidth: 80
};
@ -156,10 +157,11 @@ class Table extends 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);
}