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 values descending, nulls last #24

Open
hv92 opened this issue Aug 7, 2022 · 1 comment
Open

Sort values descending, nulls last #24

hv92 opened this issue Aug 7, 2022 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@hv92
Copy link

hv92 commented Aug 7, 2022

Hi there!

At the moment the default of this script is sort the values in ascending order with nulls last. But when I try to sort the values in descending order, the nulls values appear on the top. Is there a way to move the null values to the bottom (and also keeping nulls last when sorting in ascending order)?

It should be around lines 492-518 in jstable.js, but it's hard to understand what's happening there exactly.

Thanks!

@Trekky12
Copy link
Collaborator

Hey @hv92,

your feature request is currently not implemented.
As you already found out the sorting is done in the mentionen rows. Therefore the JavaScript sorting (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#description) with a custom sorting algorithm is used.
The custom sorting algorithm removes some possible prefixes/suffixes to enable sorting of additional values.
Additionally empty values are sorted to the top.
Feel free to submit a pull request with an option to inverse this behaviour.

@Trekky12 Trekky12 added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Oct 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants