mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Filter: ensure initial filter settings get applied
This commit is contained in:
parent
de68dff8b9
commit
ff16bfd090
@ -756,7 +756,13 @@ ts.filter = {
|
|||||||
},
|
},
|
||||||
filterInitComplete: function(c){
|
filterInitComplete: function(c){
|
||||||
var wo = c.widgetOptions,
|
var wo = c.widgetOptions,
|
||||||
count = 0;
|
count = 0,
|
||||||
|
completed = function(){
|
||||||
|
wo.filter_initialized = true;
|
||||||
|
wo.filter_initializing = false;
|
||||||
|
ts.filter.findRows(c.table, c.$table.data('lastSearch'), null);
|
||||||
|
c.$table.trigger('filterInit', c);
|
||||||
|
};
|
||||||
$.each( wo.filter_formatterInit, function(i, val) {
|
$.each( wo.filter_formatterInit, function(i, val) {
|
||||||
if (val === 1) {
|
if (val === 1) {
|
||||||
count++;
|
count++;
|
||||||
@ -765,19 +771,16 @@ ts.filter = {
|
|||||||
clearTimeout(wo.filter_initTimer);
|
clearTimeout(wo.filter_initTimer);
|
||||||
if (!wo.filter_initialized && count === wo.filter_formatterCount) {
|
if (!wo.filter_initialized && count === wo.filter_formatterCount) {
|
||||||
// filter widget initialized
|
// filter widget initialized
|
||||||
wo.filter_initialized = true;
|
completed();
|
||||||
wo.filter_initializing = false;
|
|
||||||
c.$table.trigger('filterInit', c);
|
|
||||||
} else if (!wo.filter_initialized) {
|
} else if (!wo.filter_initialized) {
|
||||||
// fall back in case a filter_formatter doesn't call
|
// fall back in case a filter_formatter doesn't call
|
||||||
// $.tablesorter.filter.formatterUpdated($cell, column), and the count is off
|
// $.tablesorter.filter.formatterUpdated($cell, column), and the count is off
|
||||||
wo.filter_initTimer = setTimeout(function(){
|
wo.filter_initTimer = setTimeout(function(){
|
||||||
wo.filter_initialized = true;
|
completed();
|
||||||
wo.filter_initializing = false;
|
|
||||||
c.$table.trigger('filterInit', c);
|
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setDefaults: function(table, c, wo) {
|
setDefaults: function(table, c, wo) {
|
||||||
var isArray, saved, indx,
|
var isArray, saved, indx,
|
||||||
// get current (default) filters
|
// get current (default) filters
|
||||||
|
Loading…
Reference in New Issue
Block a user