Created
November 15, 2016 12:58
-
-
Save AllenFang/dc16ed779a9e2daa69c2f998cfcf4d87 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 MySearchPanel extends React.Component { | |
| cleanBtnClick = () => { | |
| this.refs.seachInput.value = ''; | |
| this.props.search(''); | |
| } | |
| seachBanana = () => { | |
| this.refs.seachInput.value = 'banana'; | |
| this.props.search('banana'); | |
| } | |
| render() { | |
| return ( | |
| <div className='input-group'> | |
| <span className='input-group-btn'> | |
| <button | |
| className='btn btn-default' | |
| type='button' | |
| onClick={ this.cleanBtnClick }> | |
| Clean | |
| </button> | |
| <button | |
| className='btn btn-default' | |
| type='button' | |
| onClick={ this.seachBanana }> | |
| Banana | |
| </button> | |
| </span> | |
| <input | |
| ref='seachInput' | |
| className='form-control' | |
| type='text' | |
| disabled | |
| defaultValue={ this.props.defaultValue } | |
| placeholder={ this.props.placeholder }/> | |
| </div> | |
| ); | |
| } | |
| } | |
| class CustomSearchFieldTable2 extends React.Component { | |
| render() { | |
| const options = { | |
| clearSearch: true, | |
| searchPanel: (props) => (<MySearchPanel { ...props }/>) | |
| }; | |
| return ( | |
| <BootstrapTable data={ products } options={ options } search> | |
| <TableHeaderColumn dataField='id' isKey={ true }>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