Created
February 13, 2017 15:22
-
-
Save AllenFang/2742dad5f2750e025b3383b77be10d30 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 FullyCustomSizePerPageDropDown extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| } | |
| renderSizePerPageDropDown = props => { | |
| return ( | |
| <div className='btn-group'> | |
| { | |
| [ 10, 25, 30 ].map((n, idx) => { | |
| const isActive = (n === props.currSizePerPage) ? 'active' : null; | |
| return ( | |
| <button key={ idx } type='button' className={ `btn btn-info ${isActive}` } onClick={ () => props.changeSizePerPage(n) }>{ n }</button> | |
| ); | |
| }) | |
| } | |
| </div> | |
| ); | |
| } | |
| render() { | |
| const options = { | |
| sizePerPageDropDown: this.renderSizePerPageDropDown | |
| }; | |
| return ( | |
| <div> | |
| <BootstrapTable | |
| data={ products } | |
| options={ options } | |
| pagination> | |
| <TableHeaderColumn dataField='id' isKey>Product ID</TableHeaderColumn> | |
| <TableHeaderColumn dataField='name'>Product Name</TableHeaderColumn> | |
| <TableHeaderColumn dataField='price'>Product Price</TableHeaderColumn> | |
| </BootstrapTable> | |
| </div> | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment