From 269b01f95cfdfd01224265d36adcbca50a9377ac Mon Sep 17 00:00:00 2001 From: Mottie Date: Thu, 20 Feb 2014 14:40:17 -0600 Subject: [PATCH] filter-onlyAvail now updates all selects properly. Fixes #473. --- js/jquery.tablesorter.widgets.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/js/jquery.tablesorter.widgets.js b/js/jquery.tablesorter.widgets.js index 6ae93ddb..e5538c8e 100644 --- a/js/jquery.tablesorter.widgets.js +++ b/js/jquery.tablesorter.widgets.js @@ -1011,7 +1011,7 @@ ts.filter = { }, buildSelect: function(table, column, updating, onlyavail) { column = parseInt(column, 10); - var indx, rowIndex, tbodyIndex, len, currentValue, txt, + var indx, rowIndex, tbodyIndex, len, currentValue, txt, $filters, c = table.config, wo = c.widgetOptions, $tbodies = c.$tbodies, @@ -1054,7 +1054,12 @@ ts.filter = { options += arry[indx] !== '' ? '' : ''; } - c.$table.find('thead').find('select.' + ts.css.filter + '[data-column="' + column + '"]')[ updating ? 'html' : 'append' ](options); + // update all selects in the same column (clone thead in sticky headers & any external selects) - fixes 473 + $filters = ( c.$filters ? c.$filters : c.$table.children('thead') ).find('.' + ts.css.filter); + if (wo.filter_$externalFilters) { + $filters = $filters && $filters.length ? $filters.add(wo.filter_$externalFilters) : wo.filter_$externalFilters; + } + $filters.filter('select[data-column="' + column + '"]')[ updating ? 'html' : 'append' ](options); }, buildDefault: function(table, updating) { var columnIndex, $header,