mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-14 09:58:16 +01:00
Handling for setting value (for multiple-select) with an array or object
This commit is contained in:
parent
700143eef8
commit
18f73b21b9
@ -151,10 +151,27 @@ var et2_selectbox = et2_inputWidget.extend({
|
|||||||
set_value: function(_value) {
|
set_value: function(_value) {
|
||||||
jQuery("option",this.input).attr("selected", false);
|
jQuery("option",this.input).attr("selected", false);
|
||||||
this.value = _value;
|
this.value = _value;
|
||||||
if(jQuery("option[value='"+_value+"']", this.input).attr("selected", true).length == 0)
|
if(typeof _value == "array")
|
||||||
{
|
{
|
||||||
et2_debug("warning", "Tried to set value that isn't an option", this, _value);
|
for(var i = 0; i < _value.length; i++)
|
||||||
//console.trace();
|
{
|
||||||
|
jQuery("option[value='"+_value[i]+"']", this.input).attr("selected", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (typeof _value == "object")
|
||||||
|
{
|
||||||
|
for(var i in _value)
|
||||||
|
{
|
||||||
|
jQuery("option[value='"+_value[i]+"']", this.input).attr("selected", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(jQuery("option[value='"+_value+"']", this.input).attr("selected", true).length == 0)
|
||||||
|
{
|
||||||
|
et2_debug("warning", "Tried to set value that isn't an option", this, _value);
|
||||||
|
//console.trace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user