Here's my problem,
I am currently using the JQuery Table Sorter and I found a Comma-Digit parser on the web. The problem I am having is it doesn't seem to be working.
So here is what the column is sorted as:
This should be sorted as
The parser I am using is this:
$( function() {
$.tablesorter.addParser({
id: "fancyNumber",
is: function(s) {
return /^[0-9]?[0-9,\.]*$/.test(s);
},
format: function(s) {
return $.tablesorter.formatFloat(s.replace(/,/g, ''));
},
type: "numeric"
});
});
I just don't know I am doing wrong. Am I loading it wrong? Is the parser wrong? I need real help here and have been struggling with this problem for a while now.
Edit: Because of how I generate my columns and the columns allowed to be chosen by the user, I would never know which header is in and not. I have tried using the class="{sorter: 'fancyNumber'}" command as stated here: http://tablesorter.com/docs/example-meta-parsers.html
**Edit:**It looks like one of the columns is working correctly, but this column is still having problems. maybe because it has digits and comma seperated digits?
For anyone that comes across this question. I had to add the class to my header row. So for any header that I wanted to fancy sort, I added this class:
<th class=\"{sorter: 'fancyNumber'}\">
This turned on the sorter by default which made it work nice.
What made me realize my error in my ways was turning on the debugger like so.
$("#tblInfo").tablesorter({debug:true, widgets: ['zebra'], widgetZebra: { css: ['d0', 'd1']} });