Table sort problem
I am trying to use sortable, a jQuery plugin and while it works great I noticed that when I have a missing value in a column in addition to other values that start either with a letter or a number, for some reason the empty cell appears in the middle in DESC sort, instead of dropping down as expected.
Here's the DEMO. Please sort last column.
What do I need to modify to fi开发者_运维百科x this?
Seems like a bug that it doesn't sort mixed case of numbers and alphanumeric ones properly. E.g. if you put "zzz" instead of space, it still stays in middle.
Here's a workaround:
Updated to fix sort in other columns http://jsfiddle.net/HvKmP/31/
$(".tablesorter").tablesorter().find('td:empty').html(' ');
The updated version
http://jsfiddle.net/HvKmP/19/
There are two things to note. First, your final column had 's22' and 'a45'. Removing the letters fixed the sorting. Secondly, what's hapenning is that the sorter reads the first row and see's a number and is assuming the rest will be numerical too. The sorting for numbers is sorting the numbers, then leaving the non-numeric values as unsorted.
Actually the problem is in the javascript you are using is not sorting is the td's contain numbers as the first letter, try changing this and you will see it working.
精彩评论