mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
CssStickyHeaders: reinitialize after update. Fixes #1553
This commit is contained in:
parent
ab537dcc40
commit
4b98036045
@ -1,4 +1,4 @@
|
||||
/*! Widget: cssStickyHeaders - updated 5/24/2017 (v2.28.11) *//*
|
||||
/*! Widget: cssStickyHeaders - updated 6/16/2018 (v2.30.6) *//*
|
||||
* Requires a modern browser, tablesorter v2.8+
|
||||
*/
|
||||
/*jshint jquery:true, unused:false */
|
||||
@ -7,17 +7,7 @@
|
||||
|
||||
var ts = $.tablesorter;
|
||||
|
||||
ts.addWidget({
|
||||
id: 'cssStickyHeaders',
|
||||
priority: 10,
|
||||
options: {
|
||||
cssStickyHeaders_offset : 0,
|
||||
cssStickyHeaders_addCaption : false,
|
||||
// jQuery selector or object to attach sticky header to
|
||||
cssStickyHeaders_attachTo : null,
|
||||
cssStickyHeaders_filteredToTop : true
|
||||
},
|
||||
init : function(table, thisWidget, c, wo) {
|
||||
function cssStickyHeadersInit(c, wo) {
|
||||
var offst, adjustY,
|
||||
$table = c.$table,
|
||||
$attach = $(wo.cssStickyHeaders_attachTo),
|
||||
@ -135,21 +125,37 @@
|
||||
|
||||
});
|
||||
$table
|
||||
.unbind( ('filterEnd' + namespace).replace(/\s+/g, ' ') )
|
||||
.unbind( ('filterEnd updateComplete '.split(' ').join(namespace)).replace(/\s+/g, ' ') )
|
||||
.bind('filterEnd' + namespace, function() {
|
||||
if (wo.cssStickyHeaders_filteredToTop) {
|
||||
// scroll top of table into view
|
||||
window.scrollTo(0, $table.position().top);
|
||||
}
|
||||
})
|
||||
.bind('updateComplete' + namespace, function() {
|
||||
cssStickyHeadersInit(c, c.widgetOptions);
|
||||
});
|
||||
}
|
||||
|
||||
ts.addWidget({
|
||||
id: 'cssStickyHeaders',
|
||||
priority: 10,
|
||||
options: {
|
||||
cssStickyHeaders_offset : 0,
|
||||
cssStickyHeaders_addCaption : false,
|
||||
// jQuery selector or object to attach sticky header to
|
||||
cssStickyHeaders_attachTo : null,
|
||||
cssStickyHeaders_filteredToTop : true
|
||||
},
|
||||
init : function(table, thisWidget, c, wo) {
|
||||
cssStickyHeadersInit(c, wo);
|
||||
},
|
||||
remove: function(table, c, wo, refreshing) {
|
||||
if (refreshing) { return; }
|
||||
var namespace = c.namespace + 'cssstickyheader ';
|
||||
$(window).unbind( ('scroll resize '.split(' ').join(namespace)).replace(/\s+/g, ' ') );
|
||||
c.$table
|
||||
.unbind( ('filterEnd scroll resize '.split(' ').join(namespace)).replace(/\s+/g, ' ') )
|
||||
.unbind( ('filterEnd scroll resize updateComplete '.split(' ').join(namespace)).replace(/\s+/g, ' ') )
|
||||
.add( c.$table.children('thead').children().children() )
|
||||
.children('thead, caption').css({
|
||||
'transform' : '',
|
||||
|
Loading…
Reference in New Issue
Block a user