nicolaskruchten / pivottable

Open-source Javascript Pivot Table (aka Pivot Grid, Pivot Chart, Cross-Tab) implementation with drag'n'drop.
https://pivottable.js.org/
MIT License
4.36k stars 1.08k forks source link

is sortAs unstable wrt case? #789

Open nicolaskruchten opened 7 years ago

nicolaskruchten commented 7 years ago

["Ab","aA","aa","ab"].sort(sortAs(["Ab","Aa"])) ... ["Ab","ab","aa","aA"]

Why does aa come before aA?

hkbeer commented 7 years ago

I tried using csv and the order output without sort option is Ab, aA, aa, ab

However if use sortAs option like yours, I get the strange unexpected order as you ended up. I will take a look at the source code to see if I could find something...

hkbeer commented 7 years ago

I suspect it is those -1, 1 in source code that make the order like this. I will try to continue to study.

nicolaskruchten commented 7 years ago

Thanks for the suggestion, but I have a fix coming up already, this issue was just a note to self for me :)

On Mon, Sep 25, 2017 at 04:07 hkbeer notifications@github.com wrote:

I suspect it is those -1, 1 in source code that make the order like this. I will try to continue to study.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nicolaskruchten/pivottable/issues/789#issuecomment-331807105, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMbA2XuTzvuULC0eWJ9g_kEw5l7X-nDks5sl18cgaJpZM4PgwfG .

hkbeer commented 7 years ago

Great

hkbeer commented 7 years ago

What is your fix ? anywhere I can see it in action ? :) Would that make abc come in front of BCD easier in sorting (ie ignore case)

nicolaskruchten commented 7 years ago

Are you taking about the generic naturalSort or the sortAs helper? This issue is about the latter.

On Thu, Sep 28, 2017 at 05:58 hkbeer notifications@github.com wrote:

What is your fix ? anywhere I can see it in action ? :) Would that make abc come in front of BCD easier in sorting (ie ignore case)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nicolaskruchten/pivottable/issues/789#issuecomment-332788906, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMbAwxOwqB8nXBiWukVt4oQ2NoEpqo1ks5sm23cgaJpZM4PgwfG .

hkbeer commented 7 years ago

the naturalSort.... it is minor at the moment, but if you could think of way to order without care of case in future pls add as an option :-)

nicolaskruchten commented 7 years ago

OK. This issue is about sortAs, not naturalSort.

hkbeer commented 7 years ago

In sortAs does it accept wild cat like “a”* etc?

nicolaskruchten commented 7 years ago

No wild cards, no.

On Fri, Oct 6, 2017 at 07:47 hkbeer notifications@github.com wrote:

In sortAs does it accept wild cat like “a”* etc?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nicolaskruchten/pivottable/issues/789#issuecomment-334732723, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMbA2fFGEqM_DllJiPPT93GcRI1dVoQks5sphM4gaJpZM4PgwfG .

hkbeer commented 7 years ago

I now resort on having a custom sorting table rendered and use it as SortAs parameter in run-time to solve my ordering. So I am good now. This way I can modify the sorting of my whatever wish using SQL.

Thanks :-)