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 order errors #385

Open
javve opened this issue Feb 24, 2016 · 6 comments
Open

Sorting order errors #385

javve opened this issue Feb 24, 2016 · 6 comments
Labels

Comments

@javve
Copy link
Owner

javve commented Feb 24, 2016

I'm adding this issue as a collection of all sorting order related issues.

@saschanos
Copy link

bildschirmfoto 2016-02-28 um 17 32 24

"ü" is before "y"; in descending order

@loulafripouille
Copy link

hello,

The sorting order fails on this case : http://codepen.io/anon/pen/VaKgZB
Two almost identical values, but one with a number a the end.

@dl1ely
Copy link

dl1ely commented Mar 24, 2016

@laudeon Thanks that i am not alone. Sorting fails for me in exact the same way. I am no javascript guru, i have no idea what is going wrong there. Any advice?

@CBeloch
Copy link

CBeloch commented Apr 3, 2016

Having the same issue.

http://codepen.io/CBeloch/pen/RaLepP

It works when I rename the "PlayStation" to "PlayStation 1".
The naturalSort fails because the normChunk method gets undefined as the first parameter.
I fixed it by adding

if (!s) {
  return 0;
}

at the beginning

Pull request hast been submitted

CBeloch added a commit to SomeKindOfCode/list.js that referenced this issue Apr 3, 2016
@EugeneTM
Copy link

EugeneTM commented Oct 27, 2016

The sorting fails when the search variable contains mixed cyrilics (unicode?) and digits.
Let's say, we have four values: RA1, RA2, ЗЫ1, ЗЫ2. First two are sorted correctly, second two do not sort at all.
By the way, cyrillics without numbers is sorted well: for example, { Мартина, Густав } (Martina, Gustav) sorted correctly though.
Codepen: http://codepen.io/anon/pen/qawvNm
Now I'm trying to narrow the bug.

BTW, I found an error:

if (/[^\x00-\x80]/.test(oFxNcL + oFyNcL) && oFxNcL.localeCompare) {
                        var comp = oFxNcL.localeCompare(oFyNcL);
                        return comp / Math.abs(comp);
}

If both Unicode strings are equal, comp = 0, so we return 0/0. Also there's error should not set zero on this level, so we add if.
As the localeCompare method returns either -1, 0 or 1, we don't need division, so the code shoud be, it seems,

if (/[^\x00-\x80]/.test(oFxNcL + oFyNcL) && oFxNcL.localeCompare) {
                        var comp = oFxNcL.localeCompare(oFyNcL);
                        if (comp !== 0) return comp;
}

Please check my solution.

@darren131
Copy link

Hi I'm having a number sorting issue... I have hundreds of values e.g. 1.23; -0.23, 0.02 etc But the out of the box sorting doesn't seem to handle it... Any thoughts?
The site is here: https://www.biopharmcatalyst.com/companies/company-pipeline-database (hit the change th)

We're using data attributes to apply the sort.

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

Successfully merging a pull request may close this issue.

7 participants