Skip to content

Commit d4b3f87

Browse files
committed
fix #173
1 parent 416a98a commit d4b3f87

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/SelectRowHeaderColumn.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class SelectRowHeaderColumn extends React.Component{
66

77
render(){
88
var thStyle = {
9-
width: 35
9+
width: parseInt(this.props.width)?this.props.width:35
1010
};
1111

1212
return(

src/TableHeader.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class TableHeader extends React.Component{
88

99
constructor(props) {
1010
super(props);
11+
this.selectRowColumnWidth = null;
1112
}
1213

1314
clearSortCaret(order, sortField){
@@ -61,9 +62,9 @@ class TableHeader extends React.Component{
6162

6263
renderSelectRowHeader(){
6364
if(this.props.rowSelectType == Const.ROW_SELECT_SINGLE) {
64-
return (<SelectRowHeaderColumn></SelectRowHeaderColumn>);
65+
return (<SelectRowHeaderColumn width={this.selectRowColumnWidth}></SelectRowHeaderColumn>);
6566
}else if(this.props.rowSelectType == Const.ROW_SELECT_MULTI){
66-
return (<SelectRowHeaderColumn>
67+
return (<SelectRowHeaderColumn width={this.selectRowColumnWidth}>
6768
<input type="checkbox" onChange={this.props.onSelectAllRow} checked={this.props.isSelectAll}/>
6869
</SelectRowHeaderColumn>
6970
);
@@ -88,6 +89,8 @@ class TableHeader extends React.Component{
8889
if(Array.isArray(this.props.children)){
8990
let startPosition = (this.props.rowSelectType == Const.ROW_SELECT_SINGLE ||
9091
this.props.rowSelectType == Const.ROW_SELECT_MULTI) && !this.props.hideSelectColumn ? 1:0;
92+
if(startPosition == 1)
93+
this.selectRowColumnWidth = headerProps[0].width;
9194
for(let i=0;i<this.props.children.length;i++){
9295
this.props.children[i] =
9396
React.cloneElement(this.props.children[i], {width: headerProps[i+startPosition].width+"px"});

0 commit comments

Comments
 (0)