Last active
February 18, 2017 15:04
-
-
Save AllenFang/ae9951ad51d3a9d4daa76c3ccb19444b to your computer and use it in GitHub Desktop.
This file contains hidden or 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); | |
| this.state = { | |
| // Default expanding row | |
| expanding: [ 2 ] | |
| }; | |
| } | |
| isExpandableRow() { | |
| return true; | |
| } | |
| expandComponent(row) { | |
| return ( | |
| <BSTable data={ row.expand } /> | |
| ); | |
| } | |
| render() { | |
| const options = { | |
| expandRowBgColor: 'rgb(66, 134, 244)', | |
| expanding: this.state.expanding | |
| }; | |
| return ( | |
| <BootstrapTable data={ products } | |
| options={ options } | |
| expandableRow={ this.isExpandableRow } | |
| expandComponent={ this.expandComponent } | |
| search> | |
| <TableHeaderColumn dataField='id' isKey>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