Created
February 18, 2017 14:50
-
-
Save AllenFang/53ee94b5d4fe25bbc685a547268aaa1e 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 < 3) return true; | |
| else return false; | |
| } | |
| expandComponent(row) { | |
| return ( | |
| <BSTable data={ row.expand } /> | |
| ); | |
| } | |
| render() { | |
| const options = { | |
| expandRowBgColor: 'rgb(242, 255, 163)', | |
| expandBy: 'column' // Currently, available value is row and column, default is row | |
| }; | |
| return ( | |
| <BootstrapTable data={ products } | |
| options={ options } | |
| expandableRow={ this.isExpandableRow } | |
| expandComponent={ this.expandComponent } | |
| search> | |
| <TableHeaderColumn dataField='id' isKey={ true }>Product ID</TableHeaderColumn> | |
| <TableHeaderColumn dataField='name' expandable={ false }>Product Name</TableHeaderColumn> | |
| <TableHeaderColumn dataField='price' expandable={ false }>Product Price</TableHeaderColumn> | |
| </BootstrapTable> | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment