From 0e2235fabc25d470c6b3a5655ab7e97e126f5e0f Mon Sep 17 00:00:00 2001 From: Rob Garrison Date: Tue, 14 Mar 2017 16:53:46 -0500 Subject: [PATCH] Core: Fix method of saving default widgetOptions. See #1356 --- js/jquery.tablesorter.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/js/jquery.tablesorter.js b/js/jquery.tablesorter.js index e8fa8497..7637573a 100644 --- a/js/jquery.tablesorter.js +++ b/js/jquery.tablesorter.js @@ -431,7 +431,7 @@ var tmp = $.extend( true, {}, c.originalSettings ); // restore original settings; this clears out current settings, but does not clear // values saved to storage. - c = $.extend( true, ts.defaults, tmp ); + c = $.extend( true, {}, ts.defaults, tmp ); c.originalSettings = tmp; this.hasInitialized = false; // setup the entire table again @@ -1910,14 +1910,15 @@ }, applyWidgetOptions : function( table ) { - var indx, widget, + var indx, widget, wo, c = table.config, len = c.widgets.length; if ( len ) { for ( indx = 0; indx < len; indx++ ) { widget = ts.getWidgetById( c.widgets[ indx ] ); if ( widget && widget.options ) { - c.widgetOptions = $.extend( true, widget.options, c.widgetOptions ); + wo = $.extend( {}, widget.options ); + c.widgetOptions = $.extend( true, wo, c.widgetOptions ); // add widgetOptions to defaults for option validator $.extend( true, ts.defaults.widgetOptions, widget.options ); }