Extending onSortChange to return freshly sorted table data#1155
Open
lequesne wants to merge 2 commits intoAllenFang:masterfrom
Open
Extending onSortChange to return freshly sorted table data#1155lequesne wants to merge 2 commits intoAllenFang:masterfrom
lequesne wants to merge 2 commits intoAllenFang:masterfrom
Conversation
Owner
|
@lequesne, in my consideration, Thanks, and sorry for lately reply, I'm busy at this month. |
|
@AllenFang I have react bootstrap table with pagination. when I click on the sort button on the 3rd page data is sorted but it is not taking back to the first page . I'm expecting sort behavior like this bootstrap table https://datatables.net/examples/styling/bootstrap.html . Is this afterSortChange function takes me to the first page whenever I do sorting. |
Owner
|
@nirmalasubu, not a good solution, but you can give a try class DefaultPaginationTable extends React.Component {
constructor(props) {
super(props);
this.onSortChange = this.onSortChange.bind(this);
}
onSortChange() {
const sizePerPage = this.refs.table.state.sizePerPage;
this.refs.table.handlePaginationData(1, sizePerPage);
}
render() {
const options = {
onSortChange: this.onSortChange
};
return (
<div>
<BootstrapTable
ref='table'
data={ products }
options={ options }
pagination>
<TableHeaderColumn dataField='id' isKey={ true }>Product ID</TableHeaderColumn>
<TableHeaderColumn dataField='name' dataSort>Product Name</TableHeaderColumn>
<TableHeaderColumn dataField='price' dataSort>Product Price</TableHeaderColumn>
</BootstrapTable>
</div>
);
}
} |
|
@AllenFang It worked . Thank you |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wanted to retrieve the freshly sorted table data as a sorted array on return of onSortChange event function.
Have added the sort result as a fourth param to the onSortChange function.