Skip to content
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

Ability to disable client-side sorting #791

Closed
ah0ll0 opened this issue Aug 30, 2023 · 3 comments
Closed

Ability to disable client-side sorting #791

ah0ll0 opened this issue Aug 30, 2023 · 3 comments

Comments

@ah0ll0
Copy link
Contributor

ah0ll0 commented Aug 30, 2023

In the case of a server-paginated list we get a pre-sorted list of results from the server. The user can click column headers to select sorting by field and change direction. However, the client-side sorting can conflict with the server-side sorting. It would be helpful if we had a way to disable the actual reordering of client-side sorting for these cases. In these scenarios we handle all sorting on the back-end and any client-side sorting is either redundant or a source of bugs.

Code sandbox example

Alternative 1 - Disable sorting

If we disable sorting, the UI for sorting is not available and we would have to recreate something to do the same thing.

For this reason we use maxColumnSort with a positive value. This works most of the time, but we are surprised when the results seem out of order and have to resorted to hacks like using a modified value.

Alternative 2 - Custom "sort"
A workaround is to set column sorting to something like customSort: () => 0 to effectively make sorting avoid making any changes.

A few problems with this:

  • Only works for an individual column, so have to apply on multiple columns to avoid bugs.
  • We are still sorting, but mitigating the effect. Would be nice to avoid client-side sorting altogether.
@Domino987
Copy link
Contributor

Hi, thanks for raising this issue. I agree, if the server side sorting is done, no client side sorting should happen.

Would you mind creating a PR to address this?

@ah0ll0
Copy link
Contributor Author

ah0ll0 commented Sep 7, 2023

@Domino987 I took a stab at adding this functionality as a new option in #793. Thanks!

@Domino987
Copy link
Contributor

This will be possible with the next release

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

2 participants