Created
October 27, 2016 15:30
-
-
Save AllenFang/2073ee7f201452ba0854faa7c61556b4 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
| function getCaret(direction) { | |
| if (direction === 'asc') { | |
| return ( | |
| <span> up</span> | |
| ); | |
| } | |
| if (direction === 'desc') { | |
| return ( | |
| <span> down</span> | |
| ); | |
| } | |
| return ( | |
| <span> up/down</span> | |
| ); | |
| } | |
| class CustomSortTable extends React.Component { | |
| render() { | |
| return ( | |
| <BootstrapTable data={ products }> | |
| <TableHeaderColumn dataField='id' dataSort isKey>Product ID</TableHeaderColumn> | |
| <TableHeaderColumn dataField='name' dataSort caretRender={ getCaret }>Product Name</TableHeaderColumn> | |
| <TableHeaderColumn dataField='price' dataSort>Product Price</TableHeaderColumn> | |
| </BootstrapTable> | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment