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

Sort table in place #264

Open
jonbirge opened this issue Aug 8, 2024 · 0 comments
Open

Sort table in place #264

jonbirge opened this issue Aug 8, 2024 · 0 comments
Assignees

Comments

@jonbirge
Copy link
Owner

jonbirge commented Aug 8, 2024

Right now the table is augmented with geolocation and blacklist data dynamically in HTML, which makes it hard to sort it without redoing the entire process. The current approach is done to get the user data ASAP, and then geolocation lookups are done asynchronously at the client.

The right way to do this is to assign an ID to each table row in the DOM and do the sort as follows:

  • Read the sorted column into a JS array
  • Sort it and create a permutation array
  • Generate a new table in memory by reading the DOM rows in the right order
  • Replace the DOM table with the table in memory

This approach will allow the table to be updated without having to create a persistent JS data structure to represent the table redundant with the DOM, yet allow the update to happen atomically to avoid display issues or thrashing the DOM.

@jonbirge jonbirge self-assigned this Aug 8, 2024
@jonbirge jonbirge changed the title Hold augmented table in memory Sort table in place Aug 14, 2024
@jonbirge jonbirge added this to the 1.9 milestone Aug 14, 2024
@jonbirge jonbirge removed this from the 1.9 milestone Dec 10, 2024
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

1 participant