diff --git a/docs/index.html b/docs/index.html index f8e449d7..83324413 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1608,6 +1608,8 @@ $(function(){ stickyHeaders_attachTo : null // number or jquery selector targeting the position:fixed element stickyHeaders_offset : 0, + // scroll table top into view after filtering + stickyHeaders_filteredToTop: true, // added to table ID, if it exists stickyHeaders_cloneId : '-sticky', // trigger "resize" event on headers @@ -2628,6 +2630,22 @@ $('table').trigger('search', false); + + + Boolean + true + + Sticky Headers widget: Scroll table top into view after filtering (v2.16.2). +
+
+ When a user searches the table using the sticky header filter row the results may reduce the number of rows so that the table would scroll up out of the viewport. So, this option scrolls the table top into view and moves the filter focus to the same input in the original header, instead of the sticky header input.
+
+ Set this option to false to prevent the page scroll after filtering the table. +
+ + + + Boolean diff --git a/js/jquery.tablesorter.widgets.js b/js/jquery.tablesorter.widgets.js index c8e1bd5d..3e69828b 100644 --- a/js/jquery.tablesorter.widgets.js +++ b/js/jquery.tablesorter.widgets.js @@ -1225,6 +1225,7 @@ ts.addWidget({ stickyHeaders : '', // extra class name added to the sticky header row stickyHeaders_attachTo : null, // jQuery selector or object to attach sticky header to stickyHeaders_offset : 0, // number or jquery selector targeting the position:fixed element + stickyHeaders_filteredToTop: true, // scroll table top into view after filtering stickyHeaders_cloneId : '-sticky', // added to table ID, if it exists stickyHeaders_addResizeEvent : true, // trigger "resize" event on headers stickyHeaders_includeCaption : true, // if false and a caption exist, it won't be included in the sticky header @@ -1367,7 +1368,7 @@ ts.addWidget({ var $td = $(document.activeElement).closest('td'), column = $td.parent().children().index($td); // only scroll if sticky header is active - if ($stickyTable.hasClass(ts.css.stickyVis)) { + if ($stickyTable.hasClass(ts.css.stickyVis) && wo.stickyHeaders_filteredToTop) { // scroll to original table (not sticky clone) window.scrollTo(0, $table.position().top); // give same input/select focus; check if c.$filters exists; fixes #594