Error sorting the numbers in table
Error sorting the numbers in table

http://silentflex.com/tablas/prueba/index
Hello, I have some troubles with my table, it does not sort properly the numbers, in some columns it works fine but in other ones not, for example in the column called "Mt max nm" , you can check in the link of the test that it does not work fine... I tried changing "," with "." and tried adding the "data-order" to the <td> but it does not work so I have no idea about what´s the mistake, can you help me ? Thank you so much:
Here is a picture of the mistake, 85.30 should be over 9.7 for example.
Answers
You have none number data in that column:
Datatables will set the column type to string in this case. This is causing the sorting issue. Orthogonal data can be used to fix this. You will need to return zero for the
sort
and probably thetype
operations when the value is-
. Something like this (I didn't test this so it may need adjustments to work):See the similar example in the docs for more info.
Kevin
Thank you so much for your quick answer Kevin, I finally got the solution, it was actually quite stupid...
The problem was that I had some values with two points, for example "1.085.30" and according to your answer that may transformed the column into string data and because of that the sorting was failing, I just changed them to "1085.30" and it is fine now.