Reputation: 4364
I'm using the jQuery Tablesorter 2.0 (http://tablesorter.com/docs/). Sorting numbers is working fine, but as soon as I add
number_format($count);
to my code, the sorting is not working anymore. It sorts like this:
810,208 -> 7,671,897 -> 2,329,439
instead of
7,671,897 -> 2,329,439 -> 810,208
Any way to fix this? I need the comma separated number for better reading. Thanks
Upvotes: 3
Views: 5448
Reputation: 2734
jQuery.tablesorter.addParser({
id: "fancyNumber",
is: function(s) {
return /^[0-9]?[0-9,\.]*$/.test(s);
},
format: function(s) {
return jQuery.tablesorter.formatFloat( s.replace(/,/g,'') );
},
type: "numeric"
});
Upvotes: 11