Filter: fix filter initialization intermittently stalling

This commit is contained in:
Mottie 2014-11-03 17:33:02 -06:00
parent 98e3a41428
commit 443f963567

View File

@ -657,7 +657,7 @@ ts.filter = {
$(document)
.undelegate(wo.filter_reset, 'click.tsfilter')
.delegate(wo.filter_reset, 'click.tsfilter', function() {
// trigger a reset event, so other functions (filterFormatter) know when to reset
// trigger a reset event, so other functions (filter_formatter) know when to reset
c.$table.trigger('filterReset');
});
}
@ -764,8 +764,11 @@ ts.filter = {
completed = function(){
wo.filter_initialized = true;
c.$table.trigger('filterInit', c);
ts.filter.findRows(c.table, c.$table.data('lastSearch'), null);
ts.filter.findRows(c.table, c.$table.data('lastSearch') || []);
};
if ( $.isEmptyObject( wo.filter_formatter ) ) {
completed();
} else {
$.each( wo.filter_formatterInit, function(i, val) {
if (val === 1) {
count++;
@ -782,6 +785,7 @@ ts.filter = {
completed();
}, 500);
}
}
},
setDefaults: function(table, c, wo) {
@ -1114,10 +1118,16 @@ ts.filter = {
$(this).hasClass('filter-parsed');
}).get();
if (c.debug) { time = new Date(); }
if (c.debug) {
ts.log('Starting filter widget search', filters);
time = new Date();
}
// filtered rows count
c.filteredRows = 0;
c.totalRows = 0;
// combindedFilters are undefined on init
combinedFilters = (filters || []).join('');
for (tbodyIndex = 0; tbodyIndex < $tbodies.length; tbodyIndex++ ) {
if ($tbodies.eq(tbodyIndex).hasClass(c.cssInfoBlock || ts.css.info)) { continue; } // ignore info blocks, issue #264
$tbody = ts.processTbody(table, $tbodies.eq(tbodyIndex), true);