I am having issues using tablesorter plugin for currencies with a , in them e.g.: 9,789,000.00 etc.
Does anyone know of a work around for this?
Pls dont suggest me the other libraries.
Tablesorter allows you to define "custom parsers" for things like this.
// add parser through the tablesorter addParser method
$.tablesorter.addParser({
// set a unique id
id: 'thousands',
is: function(s) {
// return false so this parser is not auto detected
return false;
},
format: function(s) {
// format your data for normalization
return s.replace('$','').replace(/,/g,'');
},
// set type, either numeric or text
type: 'numeric'
});
$(function() {
$("table").tablesorter({
headers: {
6: {//zero-based column index
sorter:'thousands'
}
}
});
});
You may have to tweak the format function.
Also try to search here on the page, the subject has been answered discussed plenty of times like here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With