Skip to content

Commit 4d0f7cd

Browse files
committed
fix #144
1 parent 25715ac commit 4d0f7cd

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

src/TableBody.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,11 @@ class TableBody extends React.Component{
154154
selectRowHeader = this.props.selectRow.hideSelectColumn?null:(<th style={style} key={-1}></th>);
155155
}
156156
var theader = this.props.columns.map(function(column, i){
157+
let width = parseInt(column.width);
157158
let style={
158159
display: column.hidden?"none":null,
159-
width: column.width,
160-
maxWidth: column.width
160+
width: width,
161+
maxWidth: width
161162
/** add min-wdth to fix user assign column width not eq offsetWidth in large column table **/
162163
};
163164
let sortCaert = column.sort?(Util.renderReactSortCaret(Const.SORT_DESC)):null;

src/TableColumn.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,16 @@ class TableColumn extends React.Component{
2222
}
2323

2424
render(){
25+
var width = parseInt(this.props.width);
2526
var tdStyle = {
2627
textAlign: this.props.dataAlign,
2728
display: this.props.hidden?"none":null,
28-
width: this.props.width,
29-
maxWidth: this.props.width
29+
width: width,
30+
maxWidth: width
3031
};
3132
var classname = this.props.className;
32-
if(this.props.width &&
33-
this.props.width !== null && this.props.width.indexOf('px') > -1){
34-
let w = this.props.width.replace('px','');
35-
classname += " col-md-"+w;
33+
if(this.props.width){
34+
classname += " col-md-"+width;
3635
}
3736

3837

src/TableHeaderColumn.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ class TableHeaderColumn extends React.Component{
2020
}
2121

2222
render(){
23+
var width = this.props.width!==null?parseInt(this.props.width):null;
2324
var thStyle = {
2425
textAlign: this.props.dataAlign,
2526
display: this.props.hidden?"none":null,
26-
width: this.props.width,
27-
maxWidth: this.props.width
27+
width: width,
28+
maxWidth: width
2829
};
2930

3031
var classes = this.props.className+" "+(this.props.dataSort?"sort-column":"");

0 commit comments

Comments
 (0)