From d350f5d703537192787a331b032e723d2124a1ad Mon Sep 17 00:00:00 2001 From: Sascha Presnac Date: Wed, 3 Jun 2015 12:03:08 +0200 Subject: [PATCH 1/2] =?UTF-8?q?add=20support=20for=20"dirty"=20tables=20av?= =?UTF-8?q?oid=20errors=20like:=20"Uncaught=20TypeError:=20Cannot=20set=20?= =?UTF-8?q?property=20'addClass'=20of=20undefined=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jquery.tablesorter.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jquery.tablesorter.js b/jquery.tablesorter.js index c5eabf0..09b6e82 100644 --- a/jquery.tablesorter.js +++ b/jquery.tablesorter.js @@ -553,7 +553,9 @@ var l = list.length; for (var i = 0; i < l; i++) { - h[list[i][0]].addClass(css[list[i][1]]); + if (typeof(h[list[i][0]]) != 'undefined') { + h[list[i][0]].addClass(css[list[i][1]]); + } } } From 6779767ae634f6c9ff16425430f27f98b20587c6 Mon Sep 17 00:00:00 2001 From: Sascha Presnac Date: Wed, 3 Jun 2015 12:19:36 +0200 Subject: [PATCH 2/2] =?UTF-8?q?add=20support=20for=20"dirty"=20tables=20av?= =?UTF-8?q?oid=20errors=20like:=20"Uncaught=20TypeError:=20Cannot=20set=20?= =?UTF-8?q?property=20'count'=20of=20undefined=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jquery.tablesorter.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/jquery.tablesorter.js b/jquery.tablesorter.js index 09b6e82..0b1b016 100644 --- a/jquery.tablesorter.js +++ b/jquery.tablesorter.js @@ -576,8 +576,10 @@ for (var i = 0; i < l; i++) { var s = sortList[i], o = c.headerList[s[0]]; - o.count = s[1]; - o.count++; + if (typeof(o) != 'undefined') { + o.count = s[1]; + o.count++; + } } } @@ -605,8 +607,11 @@ // var s = (table.config.parsers[c].type == "text") ? ((order == 0) // ? makeSortText(c) : makeSortTextDesc(c)) : ((order == 0) ? // makeSortNumeric(c) : makeSortNumericDesc(c)); - var s = (table.config.parsers[c].type == "text") ? ((order == 0) ? makeSortFunction("text", "asc", c) : makeSortFunction("text", "desc", c)) : ((order == 0) ? makeSortFunction("numeric", "asc", c) : makeSortFunction("numeric", "desc", c)); - var e = "e" + i; + var s = ((order == 0) ? makeSortFunction("numeric", "asc", c) : makeSortFunction("numeric", "desc", c)); + if (typeof(table.config.parsers[c]) != 'undefined') { + var s = (table.config.parsers[c].type == "text") ? ((order == 0) ? makeSortFunction("text", "asc", c) : makeSortFunction("text", "desc", c)) : ((order == 0) ? makeSortFunction("numeric", "asc", c) : makeSortFunction("numeric", "desc", c)); + } + var e = "e" + i; dynamicExp += "var " + e + " = " + s; // + "(a[" + c + "],b[" + c // + "]); ";