Skip to content

Commit

Permalink
fix #885
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenFang committed Dec 17, 2016
1 parent e00f585 commit 460ba53
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/TableBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ class TableBody extends Component {
const tableHeader = this.renderTableHeader(isSelectRowDefined);
const inputType = this.props.selectRow.mode === Const.ROW_SELECT_SINGLE ? 'radio' : 'checkbox';
const CustomComponent = this.props.selectRow.customComponent;
let expandColSpan = this.props.columns.filter(col => !col.hidden).length;
if (isSelectRowDefined && !this.props.selectRow.hideSelectColumn) {
expandColSpan += 1;
}

const tableRows = this.props.data.map(function(data, r) {
const tableColumns = this.props.columns.map(function(column, i) {
Expand Down Expand Up @@ -129,17 +133,12 @@ class TableBody extends Component {
</TableRow> ];

if (this.props.expandableRow && this.props.expandableRow(data)) {
let colSpan = this.props.columns.length;
const bgColor = this.props.expandRowBgColor || this.props.selectRow.bgColor || undefined;
if (isSelectRowDefined && !this.props.selectRow.hideSelectColumn) {
colSpan += 1;
}
result.push(
<ExpandComponent
className={ trClassName }
bgColor={ bgColor }
bgColor={ this.props.expandRowBgColor || this.props.selectRow.bgColor || undefined }
hidden={ !(this.state.expanding.indexOf(key) > -1) }
colSpan={ colSpan }
colSpan={ expandColSpan }
width={ "100%" }>
{ this.props.expandComponent(data) }
</ExpandComponent>
Expand Down

0 comments on commit 460ba53

Please sign in to comment.