* InfoLog: "No filter" favorite was not resetting filters anymore

This commit is contained in:
Ralf Becker 2014-10-23 12:42:52 +00:00
parent 24494b44a7
commit 2903ca4e7f
2 changed files with 26 additions and 12 deletions

View File

@ -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;
}
}
}

View File

@ -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);
},