Sorting on value rather than string in DOM sorting
Sorting on value rather than string in DOM sorting
Hello,
In your section on sorting on live DOM
https://datatables.net/examples/plug-ins/dom_sort.html
You have an sorting mechanism for "dom-text-numeric" which should sort the column based on the numeric values of the textbox.
The example however appears to sort on the string rather than the value and fortunately the data in the example table only has 2 digit values. When you also have single digit values in the textbox the sorting mechanism classes "4" to be 'greater' than "22" as it seems to sort on text rather than the actual value?
If you add a 2 character manipulation (i.e. if (d<10) then return "0" + d;) to the sorting mechanism before the return, then the sorting mechanism works as intended.
Is there a method to implement that will sort on the actual value, rather than the string ?
Answers
Hi @MartijnTholen ,
I'd say that page is working as expected. If I change "19" to be "119" and reorder, it goes to the end of the page as expected. Likewise, if I change "66" to be "6", it goes to the end.
If you're seeing problems, please could you give steps on how to reproduce,
Cheers,
Colin