2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

fhemweb.js: add attributeName to dropdown if not present (Forum #75457)

git-svn-id: https://svn.fhem.de/fhem/trunk@14906 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2017-08-15 20:06:05 +00:00
parent 5b36d0fa59
commit 0e111244a3

View File

@ -236,9 +236,12 @@ FW_jqueryReadyFn()
.html('<a>'+$(this).html()+'</a>')
.css({cursor:"pointer"})
.click(function(){
var aname = "#sel_attr"+$(this).attr("data-name").replace(/\./g,'_');
$(aname).val($(this).text());
FW_detailSelect(aname);
var attrName = $(this).text();
var sel = "#sel_attr"+$(this).attr("data-name").replace(/\./g,'_');
if($(sel+" option[value='"+attrName+"']").length == 0)
$(sel).append('<option value="'+attrName+'">'+attrName+'</option>');
$(sel).val(attrName);
FW_detailSelect(sel, true);
});
});
@ -991,7 +994,7 @@ FW_longpoll()
/*************** WIDGETS START **************/
/*************** "Double" select in detail window ****/
function
FW_detailSelect(selEl)
FW_detailSelect(selEl, mayMissing)
{
if(selEl.target)
selEl = selEl.target;
@ -1003,18 +1006,21 @@ FW_detailSelect(selEl)
devName = $(div).attr("dev"),
cmd = $(div).attr("cmd");
for(var i1=0; i1<listArr.length; i1++) {
var i1;
for(i1=0; i1<listArr.length; i1++) {
arg = listArr[i1];
if(arg.indexOf(selVal) == 0 &&
(arg.length == selVal.length || arg[selVal.length] == ':'))
break;
}
if(i1==listArr.length)
return;
var vArr = [];
if(arg.length > selVal.length)
vArr = arg.substr(selVal.length+1).split(",");
if(i1==listArr.length && !mayMissing)
return;
if(i1<listArr.length) {
if(arg.length > selVal.length)
vArr = arg.substr(selVal.length+1).split(",");
}
var newEl = FW_replaceWidget($(selEl).next(), devName, vArr,undefined,selVal);
if(cmd == "attr")