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

How to get current sort column? #754

Open
lengjunbin-trec opened this issue Jul 15, 2022 · 2 comments
Open

How to get current sort column? #754

lengjunbin-trec opened this issue Jul 15, 2022 · 2 comments

Comments

@lengjunbin-trec
Copy link

I have used one coulmn to sort the list,but Is there any way to get the column of sort? like list.getCurrentSortColumn()

@Ezra-Siton-UIX
Copy link

Ezra-Siton-UIX commented Sep 23, 2022

No API options for this (True to sep 22).
https://listjs.com/docs/search-sort/

For now you can use plain js. and [data-sort] selector.

document.querySelectorAll('[data-sort]');

https://bobbyhadz.com/blog/javascript-get-element-by-data-attribute

Step forward - when the sort is active data-order is asc or asc:

document.querySelectorAll('[data-sort="asc"]');

So with this idea use click events and show to the user extra data (Like "the Active sort buttons"). -or- use sortStart/sortComplete events.

Hard to answer more because the Q is general.

@clintre
Copy link

clintre commented Mar 1, 2023

Have not found a good way. One of the issues we are having is when re-indexing the data, it loses the previous sort and reverts to the default sort.

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