Skip to content

Commit

Permalink
fix #156
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenFang committed Dec 1, 2015
1 parent b06a4d7 commit fe1910a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/BootstrapTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ class BootstrapTable extends React.Component {

componentDidMount() {
this._adjustHeaderWidth();
window.addEventListener('resize', this._adjustHeaderWidth.bind(this));
this.refs.body.refs.container.addEventListener('scroll', this._scrollHeader.bind(this));
window.addEventListener('resize', this._adjustHeaderWidth);
this.refs.body.refs.container.addEventListener('scroll', this._scrollHeader);
}

componentWillUnmount() {
window.removeEventListener('resize', this._adjustHeaderWidth.bind(this));
this.refs.body.refs.container.removeEventListener('scroll', this._scrollHeader.bind(this));
window.removeEventListener('resize', this._adjustHeaderWidth);
this.refs.body.refs.container.removeEventListener('scroll', this._scrollHeader);
}

componentDidUpdate() {
Expand Down Expand Up @@ -540,11 +540,11 @@ class BootstrapTable extends React.Component {
}
}

_scrollHeader(e){
_scrollHeader = (e) => {
this.refs.header.refs.container.scrollLeft = e.currentTarget.scrollLeft;
}

_adjustHeaderWidth() {
_adjustHeaderWidth = () => {
var tableHeaderDom = this.refs.header.refs.container.childNodes[0];
var tableBodyDom = this.refs.body.refs.container.childNodes[0];
if(tableHeaderDom.offsetWidth !== tableBodyDom.offsetWidth){
Expand Down

0 comments on commit fe1910a

Please sign in to comment.