keep an array for options, do not convert them to an object

This commit is contained in:
Ralf Becker 2016-04-25 08:26:44 +00:00
parent 893f449992
commit 8a96e97684

View File

@ -428,19 +428,20 @@ var et2_selectbox = (function(){ "use strict"; return et2_inputWidget.extend(
if(options.length) if(options.length)
{ {
// Break reference to content manager, we don't want to add to it // Break reference to content manager, we don't want to add to it
this.options.select_options = jQuery.extend({},this.options.select_options); this.options.select_options = jQuery.extend([], this.options.select_options);
} }
var egw = this.egw(); var egw = this.egw();
for (var i = 0; i < options.length; i++) for (var i = 0; i < options.length; i++)
{ {
this.options.select_options[et2_readAttrWithDefault(options[i], "value", options[i].textContent)] = { this.options.select_options.push({
value: et2_readAttrWithDefault(options[i], "value", options[i].textContent),
// allow options to contain multiple translated sub-strings eg: {Firstname}.{Lastname} // allow options to contain multiple translated sub-strings eg: {Firstname}.{Lastname}
"label": options[i].textContent.replace(/{([^}]+)}/g, function(str,p1) "label": options[i].textContent.replace(/{([^}]+)}/g, function(str,p1)
{ {
return egw.lang(p1); return egw.lang(p1);
}), }),
"title": et2_readAttrWithDefault(options[i], "title", "") "title": et2_readAttrWithDefault(options[i], "title", "")
}; });
} }
this.set_select_options(this.options.select_options); this.set_select_options(this.options.select_options);