Skip to content

Commit 1800a52

Browse files
committed
add clean multi sort functionality
1 parent 6873d7c commit 1800a52

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

examples/js/sort/manage-multi-sort-external-table.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export default class ExternalMultiSort extends React.Component {
3535
sortOrder: []
3636
};
3737
this.onSortChange = this.onSortChange.bind(this);
38+
this.cleanSort = this.cleanSort.bind(this);
3839
}
3940

4041
onSortChange(name, order) {
@@ -56,6 +57,13 @@ export default class ExternalMultiSort extends React.Component {
5657
});
5758
}
5859

60+
cleanSort() {
61+
this.setState({
62+
sortName: [],
63+
sortOrder: []
64+
});
65+
}
66+
5967
render() {
6068
const options = {
6169
// reassign the multi sort list by an Array
@@ -66,6 +74,7 @@ export default class ExternalMultiSort extends React.Component {
6674
};
6775
return (
6876
<div>
77+
<button className='btn ben-default' onClick={ this.cleanSort }>Clean</button>
6978
<p style={ { color: 'red' } }>sort: sortName={ this.state.sortName }, sortOrder={ this.state.sortOrder }</p>
7079
<BootstrapTable data={ products } options={ options } multiColumnSort={ 2 }>
7180
<TableHeaderColumn dataField='id' isKey={ true } dataSort={ true }>Product ID</TableHeaderColumn>

0 commit comments

Comments
 (0)