Skip to content

Instantly share code, notes, and snippets.

@AllenFang
Created October 27, 2016 15:30
Show Gist options
  • Select an option

  • Save AllenFang/2073ee7f201452ba0854faa7c61556b4 to your computer and use it in GitHub Desktop.

Select an option

Save AllenFang/2073ee7f201452ba0854faa7c61556b4 to your computer and use it in GitHub Desktop.
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