Alphanumeric Sort Not Correct

Alphanumeric Sort Not Correct

kohkcckohkcc Posts: 3Questions: 1Answers: 0

I want to sort below data:
0000091
00001
B
A
C

When I use natural sort the result will become like below:
0000091
00001
A
B
C

But my expected result should be:
00001
0000091
A
B
C

Any idea to sort above data?

Answers

  • colincolin Posts: 12,677Questions: 0Answers: 2,166

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • kohkcckohkcc Posts: 3Questions: 1Answers: 0

    Hi Thanks for reply,
    I am first time to post question here so I don't know the rules and thanks for share the rules.
    Below are the test case link:
    http://live.datatables.net/yexigaya/1/

  • colincolin Posts: 12,677Questions: 0Answers: 2,166

    Thanks for the test case. I've looked a few of the other sorting plugins, and none appear to be doing what you're after so I think you'll have to write your own. You could use the natural plugin as a basis, as most of the code will already be there.

    Colin

  • kohkcckohkcc Posts: 3Questions: 1Answers: 0

    Noted with thanks. I will try write my own code to correct the sorting.

Sign In or Register to comment.