Skip to content

Commit

Permalink
Refreshing widgets now only applies to previously installed widgets. F…
Browse files Browse the repository at this point in the history
…ixes #442
  • Loading branch information
Mottie committed Nov 27, 2013
1 parent a98551a commit 7c5a85c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions js/jquery.tablesorter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1284,11 +1284,11 @@
if (init || !(c.widgetInit[w.id])) {
if (w.hasOwnProperty('options')) {
wo = table.config.widgetOptions = $.extend( true, {}, w.options, wo );
c.widgetInit[w.id] = true;
}
if (w.hasOwnProperty('init')) {
w.init(table, w, c, wo);
}
c.widgetInit[w.id] = true;
}
if (!init && w.hasOwnProperty('format')) {
w.format(table, c, wo, false);
Expand All @@ -1311,7 +1311,8 @@
for (i = 0; i < l; i++){
if ( w[i] && w[i].id && (doAll || $.inArray( w[i].id, cw ) < 0) ) {
if (c.debug) { log( 'Refeshing widgets: Removing ' + w[i].id ); }
if (w[i].hasOwnProperty('remove')) {
// only remove widgets that have been initialized - fixes #442
if (w[i].hasOwnProperty('remove') && c.widgetInit[w[i].id]) {
w[i].remove(table, c, c.widgetOptions);
c.widgetInit[w[i].id] = false;
}
Expand Down

0 comments on commit 7c5a85c

Please # to comment.