mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Add stickyHeaders_filteredToTop option. Fixes #570
This commit is contained in:
parent
a502cc6411
commit
5afa58a3e4
@ -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);</pre></div>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
<tr id="widget-sticky-headers-filtered-to-top">
|
||||
<td><a href="#" class="permalink">stickyHeaders_filteredToTop</a></td>
|
||||
<td>Boolean</td>
|
||||
<td>true</td>
|
||||
<td>
|
||||
Sticky Headers widget: Scroll table top into view after filtering (<span class="version">v2.16.2</span>).
|
||||
<div class="collapsible">
|
||||
<br>
|
||||
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.<br>
|
||||
<br>
|
||||
Set this option to <code>false</code> to prevent the page scroll after filtering the table.
|
||||
</div>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
<tr id="widget-sticky-headers-addresizeevent">
|
||||
<td><a href="#" class="permalink">stickyHeaders_addResizeEvent</a></td>
|
||||
<td>Boolean</td>
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user