diff --git a/etemplate/js/et2_extension_nextmatch.js b/etemplate/js/et2_extension_nextmatch.js index 77c5c02fdc..6404ff1e23 100644 --- a/etemplate/js/et2_extension_nextmatch.js +++ b/etemplate/js/et2_extension_nextmatch.js @@ -414,19 +414,29 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput], { if (s == 'col_filter') { - for(var c in _set.col_filter) + // allow apps setState() to reset all col_filter by using undefined or null for it + // they can not pass {} for _set / state.state, if they need to set something + if (_set.col_filter === undefined || _set.col_filter === null) { - if (this.activeFilters.col_filter[c] !== _set.col_filter[c]) + this.activeFilters.col_filter = {}; + changed = true; + } + else + { + for(var c in _set.col_filter) { - if (_set.col_filter[c]) + if (this.activeFilters.col_filter[c] !== _set.col_filter[c]) { - this.activeFilters.col_filter[c] = _set.col_filter[c]; + if (_set.col_filter[c]) + { + this.activeFilters.col_filter[c] = _set.col_filter[c]; + } + else + { + delete this.activeFilters.col_filter[c]; + } + changed = true; } - else - { - delete this.activeFilters.col_filter[c]; - } - changed = true; } } } diff --git a/infolog/js/app.js b/infolog/js/app.js index d544b337a3..4a02b82b09 100644 --- a/infolog/js/app.js +++ b/infolog/js/app.js @@ -150,9 +150,13 @@ app.classes.infolog = AppJS.extend( */ setState: function(state) { - if (typeof state.state.action == 'undefined') state.state.action = null; - if (typeof state.state.search == 'undefined') state.state.search = null; - + // as we have to set state.state.action, we have to set all other + // for "No filter" favorite to work as expected + var to_set = {col_filter: null, filter: '', filter2: '', cat_id: '', search: '', action: null}; + for(var name in to_set) + { + if (typeof state.state[name] == 'undefined') state.state[name] = to_set[name]; + } return this._super.apply(this, arguments); },