Skip to content

Commit

Permalink
fix #86
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenFang committed Oct 21, 2015
1 parent 2dbd8dd commit 20ed3aa
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions css/react-bootstrap-table.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@
border-bottom-width: 0px;
border-bottom-style: solid;
border-bottom-color: rgb(221, 221, 221);
border-right-width: 1px;
border-right-style: inset;
border-right-color: rgb(221, 221, 221);
}

.react-bs-table .table-header > table{
table-layout: fixed;
border-top-style: hidden;
border-right-style: hidden;
}

.react-bs-table .table-header > table > thead > tr{
Expand Down
15 changes: 15 additions & 0 deletions src/BootstrapTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,17 @@ class BootstrapTable extends React.Component{
}
}

componentDidMount(){
this._adjustHeaderWidth();
window.addEventListener('resize', this._adjustHeaderWidth.bind(this));
}

componentWillUnmount() {
window.removeEventListener('resize', this._adjustHeaderWidth.bind(this));
}

componentDidUpdate(){
this._adjustHeaderWidth();
this._attachCellEditFunc();
if(this.props.options.afterTableComplete)
this.props.options.afterTableComplete();
Expand Down Expand Up @@ -410,6 +420,11 @@ class BootstrapTable extends React.Component{
return null;
}
}

_adjustHeaderWidth(){
this.refs.table.getDOMNode().childNodes[0].childNodes[0].style.width =
this.refs.table.getDOMNode().childNodes[1].childNodes[0].offsetWidth-1+"px";
}
}
BootstrapTable.propTypes = {
height: React.PropTypes.string,
Expand Down

0 comments on commit 20ed3aa

Please sign in to comment.