Modifications to cached options

- country list no longer supports options when caching
- copy options to avoid modification with additonal options
This commit is contained in:
Nathan Gray 2015-04-15 15:56:33 +00:00
parent c0097b3860
commit 1da6e78def
2 changed files with 15 additions and 3 deletions

View File

@ -2826,9 +2826,13 @@ var et2_nextmatch_customfields = et2_customfields_list.extend(et2_INextmatchHead
if(field.type == 'select') if(field.type == 'select')
{ {
if(field.values && typeof field.values[''] !== 'undefined')
{
delete(field.values['']);
}
widget = et2_createWidget("nextmatch-filterheader", { widget = et2_createWidget("nextmatch-filterheader", {
id: cf_id, id: cf_id,
label: field.label, empty_label: field.label,
select_options: field.values select_options: field.values
}, this); }, this);
} }

View File

@ -785,7 +785,12 @@ jQuery.extend(et2_selectbox,
{ {
var old_type = widget._type; var old_type = widget._type;
widget._type = type; widget._type = type;
type_options = this[type_function].call(this, widget, attrs); if(typeof attrs.other == 'string')
{
attrs.other = attrs.other.split(',');
}
// Copy, to avoid accidental modification
jQuery.extend(true, type_options, this[type_function].call(this, widget, attrs));
widget._type = old_type; widget._type = old_type;
} }
@ -1040,7 +1045,7 @@ jQuery.extend(et2_selectbox,
return this.cached_server_side_options(widget, options, attrs); return this.cached_server_side_options(widget, options, attrs);
}, },
country_options: function(widget, attrs) { country_options: function(widget, attrs) {
var options = ','+(attrs.other||[]).join(','); var options = ',';
return this.cached_server_side_options(widget, options, attrs); return this.cached_server_side_options(widget, options, attrs);
}, },
dow_options: function(widget,attrs) { dow_options: function(widget,attrs) {
@ -1068,6 +1073,9 @@ jQuery.extend(et2_selectbox,
*/ */
cached_server_side_options: function(widget, options_string, attrs) cached_server_side_options: function(widget, options_string, attrs)
{ {
// normalize options by removing trailing commas
options_string = options_string.replace(/,+$/, '');
var cache_id = widget._type+'_'+options_string; var cache_id = widget._type+'_'+options_string;
var cache = egw.window.et2_selectbox.type_cache[cache_id]; var cache = egw.window.et2_selectbox.type_cache[cache_id];
if (typeof cache == 'undefined') if (typeof cache == 'undefined')