2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

fhemweb.js: fix webCmd for widgetList

git-svn-id: https://svn.fhem.de/fhem/trunk@25924 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2022-04-05 14:38:39 +00:00
parent 80cd27178c
commit 7b999b3c3e

View File

@ -2044,6 +2044,18 @@ FW_createWidgetList(elName, devName, vArr, currVal, set, params, cmd)
return undefined; return undefined;
var newEl = $('<span><span>').get(0); var newEl = $('<span><span>').get(0);
function
setCmd()
{
cmd($(newEl).find("[name^=val]")
.map( function(){return $(this).val()} )
.get()
.join(","));
}
if(!elName)
elName = "val."+Math.random().toString(36).substr(2);
for(var i1=1; i1<vArr.length; i1++) { for(var i1=1; i1<vArr.length; i1++) {
var lvArr = vArr.slice(i1+1,i1+1+parseInt(vArr[i1])); var lvArr = vArr.slice(i1+1,i1+1+parseInt(vArr[i1]));
for(var wn in FW_widgets) { for(var wn in FW_widgets) {
@ -2052,6 +2064,8 @@ FW_createWidgetList(elName, devName, vArr, currVal, set, params, cmd)
var subEl = FW_widgets[wn].createFn(elName, devName, lvArr); var subEl = FW_widgets[wn].createFn(elName, devName, lvArr);
if(subEl) { if(subEl) {
$(newEl).append(subEl); $(newEl).append(subEl);
if(cmd)
$(subEl).change(setCmd);
break; break;
} }
} }