Large numbers don't sort properly. Larger numbers don't sort at all.
Large numbers don't sort properly. Larger numbers don't sort at all.

Using this example - http://live.datatables.net/vohiyano/1/edit
If the first digit of this 17 digit number is a 0, the column sorts properly.
If you change the first digit to a 4 or greater, the column sorts in a weird (incorrect) order.
If you add a 1 to the beginning (making it an 18 digit number), and make the second digit a 5 or greater, it refuses to sort at all.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You are running into the Javascript Max Safe Integer size of
9007199254740991
. Your numbers are larger. You can see this here:http://live.datatables.net/vohiyano/2/edit
You could try setting the column type to string but that won't easily fix your problem if you have numbers of varying length, for example:
http://live.datatables.net/xucedede/1/edit
If you have varying length numbers then you could prefix each number with leading 0's so they are all the same length.
columns.render
would be used for this. You would do this for thesort
orthogonal data type as explained here:https://datatables.net/manual/data/orthogonal-data
Kevin
Fortunately, the numbers are all exactly the same length (serial numbers). I forced the column type to string and it works perfectly.
Thanks!