From 79bc1be5a501696a08e5b2676e60b76a1c8a8b72 Mon Sep 17 00:00:00 2001 From: Mottie Date: Tue, 26 Nov 2013 13:40:59 -0600 Subject: [PATCH] Complete merge & cleanup #434 --- addons/pager/jquery.tablesorter.pager.js | 8 ++------ docs/index.html | 5 +++-- js/widgets/widget-pager.js | 4 ++-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/addons/pager/jquery.tablesorter.pager.js b/addons/pager/jquery.tablesorter.pager.js index 26836fe0..c7b80e7d 100644 --- a/addons/pager/jquery.tablesorter.pager.js +++ b/addons/pager/jquery.tablesorter.pager.js @@ -278,12 +278,8 @@ for ( i = 0; i < l; i++ ) { tds += ''; for ( j = 0; j < d[i].length; j++ ) { - // build tbody cells - var temp = $("").html(d[i][j]); - var inner = temp.find("td"); - temp = inner.length ? inner : temp.wrap("
").parent(); - - tds += temp.wrap("
").parent().html(); + // build tbody cells; watch for data containing HTML markup - see #434 + tds += /^\s*\' + d[i][j] + ''; } tds += ''; } diff --git a/docs/index.html b/docs/index.html index f92b455b..46824484 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2734,7 +2734,7 @@ $.extend($.tablesorter.themes.jui, { Function null - This function is required to return the ajax data obtained from your server into a useable format for tablesorter to apply to the table (v2.1, v2.10). + This function is required to return the ajax data obtained from your server into a useable format for tablesorter to apply to the table (v2.1, v2.14.3).

In v2.10, the returned rows is now optional. And it can either be an array of arrays or a jQuery object (not attached to the table) @@ -2753,7 +2753,8 @@ $.extend($.tablesorter.themes.jui, { [ "rowNcell1", "rowNcell2", ... "rowNcellN" ] ], [ "header1", "header2", ... "headerN" ] // optional -]Here is some example JSON (comments added, but not allowed in JSON) which is contained in the City0.json file: +]Note: In v2.14.3, the contents of the array can also contain table cell markup (i.e. "<td class='green'>+ 10%</td>").
+
Here is some example JSON (comments added, but not allowed in JSON) which is contained in the City0.json file:
{
   // total rows
   "total_rows": 80,
diff --git a/js/widgets/widget-pager.js b/js/widgets/widget-pager.js
index 21d84d25..7814e12c 100644
--- a/js/widgets/widget-pager.js
+++ b/js/widgets/widget-pager.js
@@ -464,8 +464,8 @@ tsp = ts.pager = {
 					for ( i = 0; i < l; i++ ) {
 						tds += '';
 						for ( j = 0; j < d[i].length; j++ ) {
-							// build tbody cells
-							tds += '' + d[i][j] + '';
+							// build tbody cells; watch for data containing HTML markup - see #434
+							tds += /^\s*\' + d[i][j] + '';
 						}
 						tds += '';
 					}