Created
October 28, 2016 15:54
-
-
Save AllenFang/e5010f51cbbc22fc0f2fe4f181421e24 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
| const qualityType = { | |
| 0: 'good', | |
| 1: 'bad', | |
| 2: 'unknown' | |
| }; | |
| function enumFormatter(cell, row, enumObject) { | |
| return enumObject[cell]; | |
| } | |
| class ProgrammaticallySelectFilter extends React.Component { | |
| handleBtnClick = () => { | |
| this.refs.nameCol.applyFilter(1); | |
| } | |
| render() { | |
| return ( | |
| <div> | |
| <button onClick={ this.handleBtnClick } className='btn btn-default'>Click to apply select filter</button> | |
| <BootstrapTable data={ products }> | |
| <TableHeaderColumn dataField='id' isKey>Product ID</TableHeaderColumn> | |
| <TableHeaderColumn dataField='name'>Product Name</TableHeaderColumn> | |
| <TableHeaderColumn ref='nameCol' dataField='quality' filterFormatted dataFormat={ enumFormatter } | |
| formatExtraData={ qualityType } filter={ { type: 'SelectFilter', options: qualityType } }>Product Quality</TableHeaderColumn> | |
| </BootstrapTable> | |
| </div> | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment