From 20ed3aa5eee0b1e4b4d0d7355d654d73b6bcc13f Mon Sep 17 00:00:00 2001 From: AllenFang Date: Wed, 21 Oct 2015 20:31:18 +0800 Subject: [PATCH] fix #86 --- css/react-bootstrap-table.css | 4 ++++ src/BootstrapTable.js | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/css/react-bootstrap-table.css b/css/react-bootstrap-table.css index 26db0b82b..a40946ac0 100644 --- a/css/react-bootstrap-table.css +++ b/css/react-bootstrap-table.css @@ -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{ diff --git a/src/BootstrapTable.js b/src/BootstrapTable.js index 55570d213..37fbf584e 100644 --- a/src/BootstrapTable.js +++ b/src/BootstrapTable.js @@ -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(); @@ -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,