Created
February 18, 2017 14:48
-
-
Save AllenFang/910ab7e5b2f722a23ffc4eefa8056bd8 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); | |
| } | |
| isExpandableRow(row) { | |
| if (row.id < 2) return true; | |
| else return false; | |
| } | |
| expandComponent(row) { | |
| return ( | |
| <BSTable data={ row.expand } /> | |
| ); | |
| } | |
| render() { | |
| const options = { | |
| expandRowBgColor: 'rgb(242, 255, 163)' | |
| }; | |
| return ( | |
| <BootstrapTable data={ products } | |
| options={ options } | |
| striped | |
| 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
Could you please add definition of BSTable react component because it is confuses a lot. Regards.