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

Separate display and sort values #1434

Open
GitRon opened this issue Mar 14, 2024 · 0 comments
Open

Separate display and sort values #1434

GitRon opened this issue Mar 14, 2024 · 0 comments

Comments

@GitRon
Copy link
Contributor

GitRon commented Mar 14, 2024

Is your feature request related to a problem? Please describe.

Imagine I have a column with links to projects where you display the project name as the clickable text. It's not possible to sort this column because every link starts with a "<".

Same goes for localized numbers. The float 10,000.00 would be 10.000,00 in German. Gridjs will sort this as a string, therefore totally wrong.

Describe the solution you'd like

The old jQuery datatable package solves it by separating the value where you want to sort by and the display value. I think that could be a great solution. (not the way they do it, tough 😅)

Instead of having to implement a custom sorting algorithm, we could add a new attribute to this object called sortBy or sortValue. If this is set, it will be used to sort the column by.

Supplemantal: Not sure if it's really that easy... unless you add the data via the columns and not via the table-wide data attribute.

Describe alternatives you've considered

I tried to implement the custom sorting algorithm but it creates MUCH redundant code and bloats my tables for a very defaulty case.

Additional context

I'm a Python developer, so I unfortunately can't help with a PR. But the solution could be easy to implement and a huge improvement to your package.

Best
Ronny

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