Skip to content

Sorting field and order is not taken from props when using remote datasource #1752

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
aalbul opened this issue Nov 14, 2017 · 6 comments
Closed

Comments

@aalbul
Copy link
Contributor

aalbul commented Nov 14, 2017

I found that when i use remote datasource, there is no way to reset / change sortName or sortOrder.
My use case is pretty easy. I store table data, pagination data + sorting data in redux. When i change sorting field in Redux (and not by clicking on header), this change is not reflected in the table.

This is happening because this data is not synchronised back into store inside of BootstrapTable.componentWillReceiveProps method.

aalbul pushed a commit to aalbul/react-bootstrap-table that referenced this issue Nov 14, 2017
@aalbul
Copy link
Contributor Author

aalbul commented Nov 14, 2017

I created pull request to fix it. Please review it here: #1753

@AllenFang
Copy link
Owner

@aalbul I'll check this out, thanks

@AllenFang
Copy link
Owner

@aalbul I've some feedbacks on PR

@aalbul
Copy link
Contributor Author

aalbul commented Nov 18, 2017

Thanks, please see my answer in PR :)

@AllenFang
Copy link
Owner

@aalbul released on v4.1.5. thanks your contributions

@dawnmist
Copy link

dawnmist commented Dec 3, 2017

Prior to this change, clearing a sort used to work by:

  • Using Table.cleanSort(), and
  • Setting SortOrder = undefined, SortName = '' in the table options.

Doing this with 4.2.0 (I would assume in 4.1.5 - I just tried upgrading from 4.1.4) results in BootstrapTable throwing the error: "The type of sort field and order should be both with String or Array".

The changes made for this issue do not take into account/provide any way to reset the current sort without triggering the above error. i.e. TableDataStore.setSortInfo(sortOrder, options.sortName) enforces that sortOrder must never be undefined.

powellandy pushed a commit to powellandy/react-bootstrap-table that referenced this issue Dec 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants