diff --git a/src/TableBody.js b/src/TableBody.js
index 581cb95f8..ab74825f9 100644
--- a/src/TableBody.js
+++ b/src/TableBody.js
@@ -154,10 +154,11 @@ class TableBody extends React.Component{
selectRowHeader = this.props.selectRow.hideSelectColumn?null:(
| );
}
var theader = this.props.columns.map(function(column, i){
+ let width = parseInt(column.width);
let style={
display: column.hidden?"none":null,
- width: column.width,
- maxWidth: column.width
+ width: width,
+ maxWidth: width
/** add min-wdth to fix user assign column width not eq offsetWidth in large column table **/
};
let sortCaert = column.sort?(Util.renderReactSortCaret(Const.SORT_DESC)):null;
diff --git a/src/TableColumn.js b/src/TableColumn.js
index 0f758098f..252ac7d3b 100644
--- a/src/TableColumn.js
+++ b/src/TableColumn.js
@@ -22,17 +22,16 @@ class TableColumn extends React.Component{
}
render(){
+ var width = parseInt(this.props.width);
var tdStyle = {
textAlign: this.props.dataAlign,
display: this.props.hidden?"none":null,
- width: this.props.width,
- maxWidth: this.props.width
+ width: width,
+ maxWidth: width
};
var classname = this.props.className;
- if(this.props.width &&
- this.props.width !== null && this.props.width.indexOf('px') > -1){
- let w = this.props.width.replace('px','');
- classname += " col-md-"+w;
+ if(this.props.width){
+ classname += " col-md-"+width;
}
diff --git a/src/TableHeaderColumn.js b/src/TableHeaderColumn.js
index d71e3dbc2..32e8b9aeb 100644
--- a/src/TableHeaderColumn.js
+++ b/src/TableHeaderColumn.js
@@ -20,11 +20,12 @@ class TableHeaderColumn extends React.Component{
}
render(){
+ var width = this.props.width!==null?parseInt(this.props.width):null;
var thStyle = {
textAlign: this.props.dataAlign,
display: this.props.hidden?"none":null,
- width: this.props.width,
- maxWidth: this.props.width
+ width: width,
+ maxWidth: width
};
var classes = this.props.className+" "+(this.props.dataSort?"sort-column":"");