I'm trying to write a custom parser for the jQuery plugin, Tablesorter. The idea is for it to sort the numbers in descending order on the first click.
However, when I sort the table, the order doesn't change. Sometimes a few rows move, but most of them stay the same. Here is the code:
$.tablesorter.addParser({
id: 'desc',
is: function(s) { return false },
format: function(s) {
return 1.0 / parseFloat( s.replace(/,/g,'') );
},
type: 'numeric'
});
The other parsers I've written are working fine. I tried 9999 minus the number instead of 1.0 divided by it, in case it was a problem with floats (no luck).