Skip to content

Commit

Permalink
fix #192
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenFang committed Dec 27, 2015
1 parent fe2ec20 commit 159b8f3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion css/react-bootstrap-table-all.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
}

.react-bs-container .table-header{
height: 37.5px;
height: 42px;
border: hidden;
overflow: hidden;
border-bottom: 1px solid #dddddd;
Expand Down
2 changes: 1 addition & 1 deletion css/react-bootstrap-table.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
}

.react-bs-container .table-header{
height: 37.5px;
height: 42px;
border: hidden;
overflow: hidden;
border-bottom: 1px solid #dddddd;
Expand Down
13 changes: 10 additions & 3 deletions src/TableBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ class TableBody extends React.Component{
}

componentDidMount(){
this.hardFixHeaderWidth();
this.adjustBody();
}

componentDidUpdate(){
this.hardFixHeaderWidth();
this.adjustBody();
}

render(){
Expand Down Expand Up @@ -133,7 +133,7 @@ class TableBody extends React.Component{

return(
<div ref="container" className={containerClasses} style={{height: height}}>
<table className={tableClasses}>
<table ref="body" className={tableClasses}>
{tableHeader}
<tbody>
{tableRows}
Expand Down Expand Up @@ -256,6 +256,13 @@ class TableBody extends React.Component{
return headerDomProps;
}

adjustBody() {
this.hardFixHeaderWidth();
if(this.props.condensed) {
this.refs.body.style.marginTop = "-36px";
}
}

hardFixHeaderWidth(){
var headers = this.refs.header.childNodes[0].childNodes;
for(let i=0;i<headers.length;i++){
Expand Down
3 changes: 3 additions & 0 deletions src/TableHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ class TableHeader extends React.Component{
this.props.children =
React.cloneElement(this.props.children, {width: headerProps[0].width+"px"});
}
if(this.props.condensed) {
this.refs.container.style.height = "36px";
}
this.forceUpdate();
if(isVerticalScrollBar)
this.refs.container.style.marginRight = Util.getScrollBarWidth() + "px";
Expand Down

0 comments on commit 159b8f3

Please sign in to comment.