diff --git a/data/index.js b/data/index.js index 5fed21d9..c5d7533c 100644 --- a/data/index.js +++ b/data/index.js @@ -136,6 +136,8 @@ function generateHTML(parentNode, json, rowNr = -1) { let labelNode = cE("label"); labelNode.innerText = initCap(json.id); + let isPartOfTable = (rowNr != -1); + if (json.type == "module") { ndivNeeded = false; newNode = cE("div"); @@ -170,45 +172,67 @@ function generateHTML(parentNode, json, rowNr = -1) { } else { //primitive types - //table header + //table header //no newNode created if (parentNode.nodeName.toLocaleLowerCase() == "table") { //table add the id in the header - let tdNode = cE("th"); - tdNode.id = json.id; - tdNode.innerText = initCap(json.id); //label uiFun response can change it - parentNode.firstChild.firstChild.appendChild(tdNode); // + let thNode = cE("th"); + thNode.id = json.id; + thNode.innerText = initCap(json.id); //label uiFun response can change it + parentNode.firstChild.firstChild.appendChild(thNode); // } else { if (json.type == "select") { - if (json.ro) { //e.g. for reset/restart reason: do not show a select but only show the selected option + //if part of a table, use the saved list of options, otheriwise create select and uiFun will get the options + + //newNode has no id here ... + + if (!isPartOfTable) { newNode = cE("p"); - newNode.appendChild(labelNode); - let spanNode = cE("span"); - spanNode.id = json.id; - if (json.value) spanNode.innerText = json.value; - newNode.appendChild(spanNode); + if (json.type != "button") newNode.appendChild(labelNode); //add label + } + + let valueNode; + if (json.ro) { //e.g. for reset/restart reason: do not show a select but only show the selected option + valueNode = cE("span"); + if (json.value) valueNode.innerText = json.value; } else { //

with