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 with emptyTo:'min' places emptys at top for desc & bottom for asc #577

Closed
phoxphyre opened this issue Apr 9, 2014 · 3 comments
Closed

Comments

@phoxphyre
Copy link

I created this stackoverflow question about sorting empty dates.

Helpfully, Mottie answered and included this jsfiddle. I noticed, however, that when I sort ascending the 'not sets' are at the bottom of the list and I'd expect them to be at the top. Sort-descending behaves in the opposite manner.

If change emptyTo to "max" it behaves in the expected manner.

@Mottie
Copy link
Owner

Mottie commented Apr 9, 2014

Hi @phoxphyre!

Sorry, I shared the wrong settings with you...

The emptyTo option (demo) is really only meant to support:

  • "top"
  • "bottom"
  • "none" or "zero"

It just so happens to use the same internal variables as the stringTo option (demo) which includes:

  • "max"
  • "min"
  • "top"
  • "bottom"
  • "none" or "zero"

So really, it's a bonus that emptyTo works with "min" and "max" settings, even though they are backwards.

I guess I could add two more settings, maybe something like "emptyMax" and "emptyMin" and set them properly within the internal variable... but maybe just adding a note in the documentation that it works backwards when using them in the emptyTo option.

@phoxphyre
Copy link
Author

Hiya @Mottie !

Thanks for the info. I'd noticed the stringTo settings matched, and wondered. Lucky us that we got 'em for free in emptyTo!

Option-wise emptyMin and emptyMax would be ideal, but putting min and max in the docs is also awesome.

Not sure if you'd like me to close this, or leave it open :)

@Mottie
Copy link
Owner

Mottie commented Apr 10, 2014

Eh, leave it open... I'll add emptyMin and emptyMax in the next update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants