Group: use non-cached variables when added after core init. Fixes #1158

This commit is contained in:
Rob Garrison 2016-02-16 14:16:18 -06:00
parent 4c1ce278ef
commit 9361bf7aa3
2 changed files with 9 additions and 7 deletions

File diff suppressed because one or more lines are too long

View File

@ -92,9 +92,11 @@
return hours + ':' + min + ( wo.group_time24Hour ? '' : ' ' + ( suffix || '' ) ); return hours + ':' + min + ( wo.group_time24Hour ? '' : ' ' + ( suffix || '' ) );
}, },
update : function(table, c, wo) { update : function(table) {
if ($.isEmptyObject(c.cache)) { return; } if ($.isEmptyObject(table.config.cache)) { return; }
var hasSort = typeof c.sortList[0] !== 'undefined', var c = table.config,
wo = c.widgetOptions,
hasSort = typeof c.sortList[0] !== 'undefined',
data = {}, data = {},
column = $.isArray( wo.group_forceColumn ) && typeof wo.group_forceColumn[0] !== 'undefined' ? column = $.isArray( wo.group_forceColumn ) && typeof wo.group_forceColumn[0] !== 'undefined' ?
( wo.group_enforceSort && !hasSort ? -1 : wo.group_forceColumn[0] ) : ( wo.group_enforceSort && !hasSort ? -1 : wo.group_forceColumn[0] ) :
@ -278,14 +280,14 @@
tsg.clearSavedGroups(table); tsg.clearSavedGroups(table);
}); });
c.$table.on('pagerChange.tsgrouping', function(){ c.$table.on('pagerChange.tsgrouping', function(){
tsg.update(table, c, wo); tsg.update(table);
}); });
}, },
clearSavedGroups: function(table){ clearSavedGroups: function(table){
if (table && ts.storage) { if (table && ts.storage) {
ts.storage(table, 'tablesorter-groups', ''); ts.storage(table, 'tablesorter-groups', '');
tsg.update(table, table.config, table.config.widgetOptions); tsg.update(table);
} }
} }
@ -330,7 +332,7 @@
tsg.bindEvents(table, c, wo); tsg.bindEvents(table, c, wo);
}, },
format: function(table, c, wo) { format: function(table, c, wo) {
tsg.update(table, c, wo); tsg.update(table);
}, },
remove : function(table, c, wo){ remove : function(table, c, wo){
c.$table c.$table