mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Core: ensure widgets don't get cache options. Fixes #946
This commit is contained in:
parent
cc1d4904ba
commit
60666279e2
@ -1792,13 +1792,12 @@
|
||||
|
||||
ts.applyWidgetOptions = function( table, c ){
|
||||
var indx, widget,
|
||||
len = c.widgets.length,
|
||||
wo = c.widgetOptions;
|
||||
len = c.widgets.length;
|
||||
if (len) {
|
||||
for (indx = 0; indx < len; indx++) {
|
||||
widget = ts.getWidgetById( c.widgets[indx] );
|
||||
if ( widget && 'options' in widget ) {
|
||||
wo = table.config.widgetOptions = $.extend( true, {}, widget.options, wo );
|
||||
c.widgetOptions = $.extend( true, {}, widget.options, c.widgetOptions );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1808,7 +1807,6 @@
|
||||
table = $(table)[0]; // in case this is called externally
|
||||
var indx, len, names, widget, name, applied,
|
||||
c = table.config,
|
||||
wo = c.widgetOptions,
|
||||
tableClass = ' ' + c.table.className + ' ',
|
||||
widgets = [],
|
||||
time, time2, w, wd;
|
||||
@ -1866,14 +1864,14 @@
|
||||
c.widgetInit[ name ] = true;
|
||||
if (table.hasInitialized) {
|
||||
// don't reapply widget options on tablesorter init
|
||||
ts.applyWidgetOptions( table, c );
|
||||
ts.applyWidgetOptions( table, table.config );
|
||||
}
|
||||
if ( 'init' in widget ) {
|
||||
applied = true;
|
||||
if (c.debug) {
|
||||
console[ console.group ? 'group' : 'log' ]( 'Initializing ' + name + ' widget' );
|
||||
}
|
||||
widget.init(table, widget, c, wo);
|
||||
widget.init(table, widget, table.config, table.config.widgetOptions);
|
||||
}
|
||||
}
|
||||
if ( !init && 'format' in widget ) {
|
||||
@ -1881,7 +1879,7 @@
|
||||
if (c.debug) {
|
||||
console[ console.group ? 'group' : 'log' ]( 'Updating ' + name + ' widget' );
|
||||
}
|
||||
widget.format(table, c, wo, false);
|
||||
widget.format(table, table.config, table.config.widgetOptions, false);
|
||||
}
|
||||
if (c.debug) {
|
||||
if (applied) {
|
||||
|
@ -465,6 +465,10 @@
|
||||
}, 40 );
|
||||
});
|
||||
wo.math_isUpdating = false;
|
||||
// math widget initialized after table - see #946
|
||||
if ( table.hasInitialized ) {
|
||||
math.recalculate( c, wo, true );
|
||||
}
|
||||
},
|
||||
// this remove function is called when using the refreshWidgets method or when destroying the tablesorter plugin
|
||||
// this function only applies to tablesorter v2.4+
|
||||
|
Loading…
Reference in New Issue
Block a user