Filter: filterInit delayed to prevent the beloved filter event spam. Fixes #668

This commit is contained in:
Mottie 2014-07-17 07:55:32 -05:00
parent 9e1746cc2f
commit 9dea6c656e

View File

@ -699,19 +699,24 @@ ts.filter = {
} }
} }
c.$table.trigger('filterFomatterUpdate'); c.$table.trigger('filterFomatterUpdate');
if (!wo.filter_initialized) { // trigger init after setTimeout to prevent multiple filterStart/End/Init triggers
// filter widget initialized setTimeout(function(){
wo.filter_initialized = true; if (!wo.filter_initialized) {
c.$table.trigger('filterInit', c); // filter widget initialized
} wo.filter_initialized = true;
c.$table.trigger('filterInit', c);
}
}, 1);
}); });
// if filter widget is added after pager has initialized; then set filter init flag // if filter widget is added after pager has initialized; then set filter init flag
if (c.pager && c.pager.initialized && !wo.filter_initialized) { setTimeout(function(){
wo.filter_initialized = true; if (c.pager && c.pager.initialized && !wo.filter_initialized) {
c.$table wo.filter_initialized = true;
.trigger('filterFomatterUpdate') c.$table
.trigger('filterInit', c); .trigger('filterFomatterUpdate')
} .trigger('filterInit', c);
}
}, 1);
}, },
setDefaults: function(table, c, wo) { setDefaults: function(table, c, wo) {