-
Notifications
You must be signed in to change notification settings - Fork 490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comma seperated numbers #123
Comments
There is a workaround for this
|
does not work for me |
You'd need to add a custom parser (demo): var unitSeparator = ',';
var regex = new RegExp('[\s' + unitSeparator + ']', 'g');
$.tablesorter.addParser({
id: 'removeDigitSep',
is: function() {
// don't autodetect
return false;
},
format: function(s) {
var num = $.tablesorter.formatFloat(s.replace(regex, ''));
// return numeric value or original string
return $.isNumeric(num) ? num : s;
}
});
$('table').tablesorter({
headers: {
0: {
sorter: 'removeDigitSep'
}
}
}); |
Replying to @juanalvarezg
|
I dont know why :( this workaround just makes sure that we parse a float number. the sorting happens outside this logic. I did that on january 2017. Are you using the latest component? if so, maybe try with the version that was released around january 2017. |
I have an issue where comma separated numbers aren't sorting the same as non comma separated numbers.
Doing a Low to High sort results in the following
The text was updated successfully, but these errors were encountered: