Created
February 18, 2017 14:55
-
-
Save AllenFang/53ad550ae2e74d07ebcd2a1659d36e3d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ExpandRow extends React.Component { | |
constructor(props) { | |
super(props); | |
} | |
isExpandableRow(row) { | |
if (row.id < 3) return true; | |
else return false; | |
} | |
expandComponent(row) { | |
return ( | |
<BSTable data={ row.expand } /> | |
); | |
} | |
render() { | |
const options = { | |
expandRowBgColor: 'rgb(242, 255, 163)' | |
}; | |
const cellEdit = { | |
mode: 'click' | |
}; | |
return ( | |
<BootstrapTable data={ products } | |
options={ options } | |
expandableRow={ this.isExpandableRow } | |
expandComponent={ this.expandComponent } | |
cellEdit={ cellEdit }> | |
<TableHeaderColumn dataField='id' isKey={ true }>Product ID</TableHeaderColumn> | |
<TableHeaderColumn dataField='name'>Product Name</TableHeaderColumn> | |
<TableHeaderColumn dataField='price'>Product Price</TableHeaderColumn> | |
</BootstrapTable> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment