mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 09:09:04 +01:00
Move filterheader using taglist to its own widget, nextmatch-taglistheader, and revert changes to nextmatch-filterheader & nextmatch-accountfilter
This commit is contained in:
parent
31a3d38b51
commit
63d9cfbd41
@ -26,9 +26,9 @@
|
||||
// Include all widgets the nextmatch extension will create
|
||||
et2_widget_template;
|
||||
et2_widget_grid;
|
||||
et2_widget_selectbox;
|
||||
et2_widget_selectAccount;
|
||||
et2_widget_taglist;
|
||||
et2_widget_taglist_account;
|
||||
et2_widget_link;
|
||||
et2_extension_customfields;
|
||||
|
||||
// Include all nextmatch subclasses
|
||||
@ -3404,6 +3404,92 @@ var et2_nextmatch_accountfilterheader = (function(){ "use strict"; return et2_ta
|
||||
});}).call(this);
|
||||
et2_register_widget(et2_nextmatch_accountfilterheader, ['nextmatch-accountfilter']);
|
||||
|
||||
/**
|
||||
* Filter allowing multiple values to be selected, base on a taglist instead
|
||||
* of a regular selectbox
|
||||
*
|
||||
* @augments et2_taglist
|
||||
*/
|
||||
var et2_nextmatch_taglistheader = (function(){ "use strict"; return et2_taglist.extend([et2_INextmatchHeader, et2_IResizeable],
|
||||
{
|
||||
attributes: {
|
||||
autocomplete_url: { default: ''},
|
||||
multiple: { default: 'toggle'},
|
||||
onchange: {
|
||||
default: function(event) {
|
||||
if(typeof this.nextmatch === 'undefined')
|
||||
{
|
||||
// Not fully set up yet
|
||||
return;
|
||||
}
|
||||
var col_filter = {};
|
||||
col_filter[this.id] = this.getValue();
|
||||
// Set value so it's there for response (otherwise it gets cleared if options are updated)
|
||||
//event.data.set_value(event.data.input.val());
|
||||
|
||||
this.nextmatch.applyFilters({col_filter: col_filter});
|
||||
}
|
||||
},
|
||||
rows: { default: 2},
|
||||
class: {default: 'nm_filterheader_taglist'},
|
||||
},
|
||||
|
||||
/**
|
||||
* Override to add change handler
|
||||
*
|
||||
* @memberOf et2_nextmatch_filterheader
|
||||
*/
|
||||
createInputWidget: function() {
|
||||
// Make sure there's an option for all
|
||||
if(!this.options.empty_label && (!this.options.select_options || !this.options.select_options[""]))
|
||||
{
|
||||
this.options.empty_label = this.options.label ? this.options.label : egw.lang("All");
|
||||
}
|
||||
this._super.apply(this, arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
* Disable toggle if there are 2 or less options
|
||||
* @param {Object[]} options
|
||||
*/
|
||||
set_select_options: function(options)
|
||||
{
|
||||
if(options && options.length <= 2 && this.options.multiple == 'toggle')
|
||||
{
|
||||
this.set_multiple(false)
|
||||
}
|
||||
this._super.apply(this, arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
* Set nextmatch is the function which has to be implemented for the
|
||||
* et2_INextmatchHeader interface.
|
||||
*
|
||||
* @param {et2_nextmatch} _nextmatch
|
||||
*/
|
||||
setNextmatch: function(_nextmatch) {
|
||||
this.nextmatch = _nextmatch;
|
||||
|
||||
// Set current filter value from nextmatch settings
|
||||
if(this.nextmatch.activeFilters.col_filter && typeof this.nextmatch.activeFilters.col_filter[this.id] != "undefined")
|
||||
{
|
||||
this.set_value(this.nextmatch.activeFilters.col_filter[this.id]);
|
||||
|
||||
// Make sure it's set in the nextmatch
|
||||
_nextmatch.activeFilters.col_filter[this.id] = this.getValue();
|
||||
}
|
||||
},
|
||||
|
||||
// Make sure selectbox is not longer than the column
|
||||
resize: function() {
|
||||
this.div.css("height",'');
|
||||
this.div.css("max-width",jQuery(this.parentNode).innerWidth() + "px");
|
||||
this._super.apply(this, arguments);
|
||||
}
|
||||
|
||||
});}).call(this);
|
||||
et2_register_widget(et2_nextmatch_taglistheader, ['nextmatch-taglistheader']);
|
||||
|
||||
/**
|
||||
* @augments et2_link_entry
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user