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+
|
* Requires a modern browser, tablesorter v2.8+
|
||||||
*/
|
*/
|
||||||
/*jshint jquery:true, unused:false */
|
/*jshint jquery:true, unused:false */
|
||||||
@ -7,17 +7,7 @@
|
|||||||
|
|
||||||
var ts = $.tablesorter;
|
var ts = $.tablesorter;
|
||||||
|
|
||||||
ts.addWidget({
|
function cssStickyHeadersInit(c, wo) {
|
||||||
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) {
|
|
||||||
var offst, adjustY,
|
var offst, adjustY,
|
||||||
$table = c.$table,
|
$table = c.$table,
|
||||||
$attach = $(wo.cssStickyHeaders_attachTo),
|
$attach = $(wo.cssStickyHeaders_attachTo),
|
||||||
@ -135,21 +125,37 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
$table
|
$table
|
||||||
.unbind( ('filterEnd' + namespace).replace(/\s+/g, ' ') )
|
.unbind( ('filterEnd updateComplete '.split(' ').join(namespace)).replace(/\s+/g, ' ') )
|
||||||
.bind('filterEnd' + namespace, function() {
|
.bind('filterEnd' + namespace, function() {
|
||||||
if (wo.cssStickyHeaders_filteredToTop) {
|
if (wo.cssStickyHeaders_filteredToTop) {
|
||||||
// scroll top of table into view
|
// scroll top of table into view
|
||||||
window.scrollTo(0, $table.position().top);
|
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) {
|
remove: function(table, c, wo, refreshing) {
|
||||||
if (refreshing) { return; }
|
if (refreshing) { return; }
|
||||||
var namespace = c.namespace + 'cssstickyheader ';
|
var namespace = c.namespace + 'cssstickyheader ';
|
||||||
$(window).unbind( ('scroll resize '.split(' ').join(namespace)).replace(/\s+/g, ' ') );
|
$(window).unbind( ('scroll resize '.split(' ').join(namespace)).replace(/\s+/g, ' ') );
|
||||||
c.$table
|
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() )
|
.add( c.$table.children('thead').children().children() )
|
||||||
.children('thead, caption').css({
|
.children('thead, caption').css({
|
||||||
'transform' : '',
|
'transform' : '',
|
||||||
|
Loading…
Reference in New Issue
Block a user