From 967515d31f7b83201ffe8563509b51bba827b424 Mon Sep 17 00:00:00 2001 From: oupablo Date: Thu, 19 Feb 2015 16:36:34 -0500 Subject: [PATCH] Update jquery.tablesorter.js added better support for numbers with commas in it --- jquery.tablesorter.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/jquery.tablesorter.js b/jquery.tablesorter.js index c5eabf0..95b939d 100644 --- a/jquery.tablesorter.js +++ b/jquery.tablesorter.js @@ -862,7 +862,7 @@ }; this.isDigit = function (s, config) { // replace all an wanted chars and match. - return /^[-+]?\d*$/.test($.trim(s.replace(/[,.']/g, ''))); + return /^\d+$/.test(s); }; this.clearTableBody = function (table) { if ($.browser.msie) { @@ -903,6 +903,17 @@ return $.tablesorter.formatFloat(s); }, type: "numeric" }); + + $.tablesorter.addParser({ + id: "uiDigit", + is: function (s, table) { + //return false; + return new RegExp(/^([0-9]{1,3}[,.])+[0-9]+$/).test(s); + }, format: function (s) { + + return $.tablesorter.formatFloat(s.replace(',', "")); + }, type: "numeric" + }); ts.addParser({ id: "currency",