From eb13fb4b14904121fd915fca39f217273c669bef Mon Sep 17 00:00:00 2001 From: Mottie Date: Sun, 15 Dec 2013 04:49:55 -0600 Subject: [PATCH] Fix pager update when ajax returns no rows. Fixes #456 --- addons/pager/jquery.tablesorter.pager.js | 2 +- js/widgets/widget-pager.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/pager/jquery.tablesorter.pager.js b/addons/pager/jquery.tablesorter.pager.js index d04b6b46..c27ba1bc 100644 --- a/addons/pager/jquery.tablesorter.pager.js +++ b/addons/pager/jquery.tablesorter.pager.js @@ -272,7 +272,7 @@ //ensure a zero returned row count doesn't fail the logical || rr_count = result[t ? 1 : 0]; p.totalRows = isNaN(rr_count) ? p.totalRows || 0 : rr_count; - d = p.totalRows === 0 ? [] : result[t ? 0 : 1] || []; // row data + d = p.totalRows === 0 ? [""] : result[t ? 0 : 1] || []; // row data th = result[2]; // headers } l = d.length; diff --git a/js/widgets/widget-pager.js b/js/widgets/widget-pager.js index c95a776d..c1627a89 100644 --- a/js/widgets/widget-pager.js +++ b/js/widgets/widget-pager.js @@ -458,7 +458,7 @@ tsp = ts.pager = { //ensure a zero returned row count doesn't fail the logical || rr_count = result[t ? 1 : 0]; p.totalRows = isNaN(rr_count) ? p.totalRows || 0 : rr_count; - d = p.totalRows === 0 ? [] : result[t ? 0 : 1] || []; // row data + d = p.totalRows === 0 ? [""] : result[t ? 0 : 1] || []; // row data th = result[2]; // headers } l = d.length;