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:
- 4,666
- 141,666
- 293
- 341,666
- 346
- 461,676
This should be sorted as
- 293
- 346
- 4,666
- 141,666
- 341,666
- 461,676
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?