Skip to content

Commit

Permalink
Don't set column width when it is null
Browse files Browse the repository at this point in the history
The current implementation results is the following warning:

Warning: `NaN` is an invalid value for the `width` css style property. Check the render method of `TableBody`.
  • Loading branch information
Hamza Kaya committed May 18, 2016
1 parent f181677 commit 4018df5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/TableBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,16 @@ class TableBody extends Component {
}
}
const theader = this.props.columns.map(function(column, i) {
const width = column.width === null ? column.width : parseInt(column.width, 10);
const style = {
display: column.hidden ? 'none' : null,
width: width,
minWidth: width
display: column.hidden ? 'none' : null
};
if (column.width) {
const width = parseInt(column.width, 10);
style.width = width;
/** add min-wdth to fix user assign column width
not eq offsetWidth in large column table **/
};
style.minWidth = width;
}
return (<col style={ style } key={ i } className={ column.className }></col>);
});

Expand Down

0 comments on commit 4018df5

Please sign in to comment.