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

[Sorting] There is no way to clear the applied sorting #121

Open
CMH-Benny opened this issue Aug 5, 2024 · 4 comments
Open

[Sorting] There is no way to clear the applied sorting #121

CMH-Benny opened this issue Aug 5, 2024 · 4 comments
Labels
enhancement Something that would make existing features better

Comments

@CMH-Benny
Copy link

CMH-Benny commented Aug 5, 2024

Hey there, it's me again :D

after the Persistence was fixed to restore the URL params properly I noticed that suddenly the persistance of sorting also works better as before, previously it was only possible to apply sorting for one column, but now it adds sorting for multiple columns if clicked. However it is fully impossible to escape this state now, because even if you delete the sort params from URL and reload the page, the persistence retores them. Is there an easy way to add a clear sorting button or add a third state to the colum header to take sorting away?

Steps to reproduce:

  • Open table
  • Click sortable colum header
  • Click another sortable column header
  • See both "active" and see if behavior is correct, for me it isn't
  • Try to get back to a single column to be sorted, or go back to no sorting (for me it's impossible)

It also seems that multi sort doesn't work perfectly, could be my search index that has the issues, I pass it multiple sorts actually, however I guess the order matters and we can't control the order currently, so I guess without further thinking it's not the best idea to allow multi sort?

WDYT?

@Kreyu
Copy link
Owner

Kreyu commented Aug 5, 2024

Hey @CMH-Benny, thanks for the report - should be fixed in 0.21.2

@CMH-Benny
Copy link
Author

CMH-Benny commented Aug 6, 2024

Oh wow, you're fast! 😮
Thank you so much, I updated it and now it is back to only allow one column to be sorted. 🎉

I still can't remove the sorting, so after a sorting was applied once, you can only switch the column, but no way to go to the default state, if persitence is enabled. It's not the biggest Deal, for me it works good enough for now, but it might be worth to revisit this in the future to allow for multi column sort and clearing off a sorting at some point.

Thank you so much for your fast reaction and fix, looking good now 👍❤️

@Kreyu
Copy link
Owner

Kreyu commented Aug 6, 2024

Oh, right, I focused on the bug and ignored the fact we're talking about clearing the sorting - sorry.

You're right, currently there's no way to remove applied sorting - the controls are always alternating between "asc" and "desc". I think the most common way to handle this is alternating between "asc", "desc" and "don't sort" (we'll have to send null to prevent loading from persistence). I'll try to implement it soon, good to know the bug is gone 😄

Cheers

@CMH-Benny
Copy link
Author

CMH-Benny commented Aug 6, 2024

Thank you so much! And no problem at all - It kinda was about two things, the bug and the clearing :)

I think a third toggle state is the easiest option for now and is a quick win 🎉

In the long run it might be a nice addition if there is a dropdown or some other fancy control element that allows to choose asc/desc/clear and to set a priority, so that we could kinda control the order that would allow for controlled multi sort then, but this is for sure a whole new feature :)

Thanks again for fixing the issue so fast! I am close to have a first version with your awesome bundle running ❤️

@Kreyu Kreyu added the enhancement Something that would make existing features better label Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Something that would make existing features better
Projects
None yet
Development

No branches or pull requests

2 participants