diff --git a/jquery.tablesorter.js b/jquery.tablesorter.js index c5eabf0..29d7b74 100644 --- a/jquery.tablesorter.js +++ b/jquery.tablesorter.js @@ -131,7 +131,8 @@ decimal: '/\.|\,/g', onRenderHeader: null, selectorHeaders: 'thead th', - debug: false + debug: false, + thousandsSeparator: ',' }; /* debuging utils */ @@ -899,7 +900,8 @@ is: function (s, table) { var c = table.config; return $.tablesorter.isDigit(s, c); - }, format: function (s) { + }, format: function (s, table) { + s = s.replace(table.config.thousandsSeparator, ''); return $.tablesorter.formatFloat(s); }, type: "numeric" }); @@ -908,8 +910,9 @@ id: "currency", is: function (s) { return /^[£$€?.]/.test(s); - }, format: function (s) { - return $.tablesorter.formatFloat(s.replace(new RegExp(/[£$€]/g), "")); + }, format: function (s, table) { + var regex = new RegExp("[£$€"+table.config.thousandsSeparator+"]", "g"); + return $.tablesorter.formatFloat(s.replace(regex, "")); }, type: "numeric" });