optional parameter for et2_nextmatch.applyFilters(_set) to certain filters before updating the rows, eg. applyFilters({ filter: '', search: ''}); to reset filter to 'all', remove search and update the rows

This commit is contained in:
Ralf Becker 2013-07-03 14:29:17 +00:00
parent 349da32512
commit 486298a7c9

View File

@ -294,7 +294,12 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput],
}
},
applyFilters: function() {
/**
* Apply current or modified filters on NM widget (updating rows accordingly)
*
* @param _set filter(s) to set eg. { filter: '' } to reset filter in NM header
*/
applyFilters: function(_set) {
this.egw().debug("info", "Changing nextmatch filters to ", this.activeFilters);
if(typeof this.activeFilters == "undefined")
@ -305,6 +310,24 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput],
{
this.activeFilters.col_filter = {};
}
if (typeof _set == 'object')
{
for(var s in _set)
{
if (s == 'col_filter')
{
for(var c in _set.col_filter)
{
this.activeFilters.col_filter[c] = _set.col_filter[c];
}
}
else
{
this.activeFilters[s] = _set[s];
}
}
}
// Update the filters in the grid controller
this.controller.setFilters(this.activeFilters);
@ -1437,6 +1460,7 @@ var et2_nextmatch_header_bar = et2_DOMWidget.extend(et2_INextmatchHeader,
var widget_options = {
"id": name,
"label": this.nextmatch.options.settings[name+"_label"],
"no_lang": lang
};
// Set select options