From b34bbba563c17bf2a4112ab3d8507e8f27c374fa Mon Sep 17 00:00:00 2001 From: Mottie Date: Sun, 15 Dec 2013 07:11:26 -0600 Subject: [PATCH] Filter row is now included in stickyHeader + pager. Fixes #449 --- addons/pager/jquery.tablesorter.pager.js | 2 +- js/jquery.tablesorter.widgets.js | 5 ++++- js/widgets/widget-pager.js | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/pager/jquery.tablesorter.pager.js b/addons/pager/jquery.tablesorter.pager.js index 7ca66050..17c3c9c0 100644 --- a/addons/pager/jquery.tablesorter.pager.js +++ b/addons/pager/jquery.tablesorter.pager.js @@ -298,7 +298,7 @@ // only add new header text if the length matches if ( th && th.length === hl ) { hsh = $t.hasClass('hasStickyHeaders'); - $sh = hsh ? c.$sticky.children('thead:first').children().children() : ''; + $sh = hsh ? c.widgetOptions.$sticky.children('thead:first').children().children() : ''; $f = $t.find('tfoot tr:first').children(); // don't change td headers (may contain pager) c.$headers.filter('th').each(function(j){ diff --git a/js/jquery.tablesorter.widgets.js b/js/jquery.tablesorter.widgets.js index 5e65293b..a3786cc4 100644 --- a/js/jquery.tablesorter.widgets.js +++ b/js/jquery.tablesorter.widgets.js @@ -1066,7 +1066,10 @@ ts.addWidget({ stickyHeaders_zIndex : 2 // The zIndex of the stickyHeaders, allows the user to adjust this to their needs }, format: function(table, c, wo) { - if (c.$table.hasClass('hasStickyHeaders')) { return; } + // filter widget doesn't initialize on an empty table. Fixes #449 + if ( c.$table.hasClass('hasStickyHeaders') || ($.inArray('filter', c.widgets) >= 0 && !c.$table.hasClass('hasFilters')) ) { + return; + } var $cell, $table = c.$table, $attach = $(wo.stickyHeaders_attachTo), diff --git a/js/widgets/widget-pager.js b/js/widgets/widget-pager.js index 95d1aae2..099e7ad3 100644 --- a/js/widgets/widget-pager.js +++ b/js/widgets/widget-pager.js @@ -484,7 +484,7 @@ tsp = ts.pager = { // only add new header text if the length matches if ( th && th.length === hl ) { hsh = $t.hasClass('hasStickyHeaders'); - $sh = hsh ? c.$sticky.children('thead:first').children().children() : ''; + $sh = hsh ? wo.$sticky.children('thead:first').children().children() : ''; $f = $t.find('tfoot tr:first').children(); // don't change td headers (may contain pager) c.$headers.filter('th').each(function(j){