mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
88f7aa1a8f
git-svn-id: https://svn.fhem.de/fhem/trunk@5037 2b470e98-0d58-463d-a4d8-8e2adae1ed80
38 lines
847 B
JavaScript
38 lines
847 B
JavaScript
function
|
|
FW_multipleSelChange(name, devName, vArr)
|
|
{
|
|
if(vArr.length < 2 || vArr[0] != "multiple")
|
|
return undefined;
|
|
|
|
var o = new Object();
|
|
o.newEl = document.createElement('select');
|
|
o.newEl.setAttribute('multiple', true);
|
|
for(var j=1; j < vArr.length; j++) {
|
|
var s = vArr[j].replace(/#/g," ");
|
|
o.newEl.options[j-1] = new Option(s, s);
|
|
}
|
|
o.qFn = 'FW_multipleSetSelected(qArg, "%")';
|
|
o.qArg = o.newEl;
|
|
return o;
|
|
}
|
|
|
|
function
|
|
FW_multipleSetSelected(el, val)
|
|
{
|
|
if(typeof el == 'string')
|
|
el = document.getElementById(el);
|
|
|
|
var l = val.split(",");
|
|
for(var j=0;j<el.options.length;j++)
|
|
for(var i=0;i<l.length;i++)
|
|
if(el.options[j].value == l[i])
|
|
el.options[j].selected = true;
|
|
|
|
if(el.onchange)
|
|
el.onchange();
|
|
}
|
|
|
|
FW_widgets['multiple'] = {
|
|
selChange:FW_multipleSelChange
|
|
};
|