Skip to content

Commit

Permalink
make parameter editor disable when parameter is changed by URL
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoranzhou committed Apr 17, 2024
1 parent c87cfb8 commit 1fd6ad4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -77052,6 +77052,7 @@ <h1 class="modal-title fs-5" id="loadingModalLabel">Simulation Running</h1>

var xmlNodes = [].slice.call(xmlDoc.children[0].children);
let htmlText = "";
let editable = "";
htmlText += `<div class="accordion" id="accordionExample">`;
for (const [index, element] of xmlNodes.entries()) {
var elementParamters = [].slice.call(element.children);
Expand All @@ -77072,10 +77073,14 @@ <h2 class="accordion-header">
htmlText += `<span class="input-group-text ">` + parameter.getAttribute(attr) + `</span>
`
} else {
try{
editable = xmlDoc.children[0].children[index].children[Parameter_index].getAttribute("changed_by_URL")

}catch(e){}
htmlText += `<span class="input-group-text ">` + attr + `</span>
<input type="number" class="form-control fs-6" value=`+ parameter.getAttribute(attr) + `
onchange="xmlDoc.children[0].children[`+ index + `].children[` + Parameter_index + `].setAttribute('` + attr + `' , this.value);
XMLParameter = new XMLSerializer().serializeToString(xmlDoc.documentElement);">
XMLParameter = new XMLSerializer().serializeToString(xmlDoc.documentElement);"`+editable+`>
`
}
}
Expand Down Expand Up @@ -77148,11 +77153,15 @@ <h2 class="accordion-header">
const param1 = element.split("=");
const param10 = param1[0].split(",");
const xpathText = '//organ[@type="'+param10[0]+'" and @subType="'+param10[1]+'"]/parameter[@name="'+param10[2]+'"]/@value';
const xpathText2 = '//organ[@type="'+param10[0]+'" and @subType="'+param10[1]+'"]/parameter[@name="'+param10[2]+'"]';
//console.log(xpathText);
var paramElement = xmlDoc.evaluate(xpathText, xmlDoc, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
var paramElement2 = xmlDoc.evaluate(xpathText2, xmlDoc, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
paramElement.singleNodeValue.value = param1[1];
//console.log(paramElement.singleNodeValue.value);
console.log("paramElement.singleNodeValue.checked is :"+paramElement.singleNodeValue.checked);
URLToast1("The value of parameter: "+ param10[0] + " organ ; subType: " + param10[1] + "; name: " + param10[2] +" has been changed to "+ param1[1]);

paramElement2.singleNodeValue.setAttribute("changed_by_URL","disabled");
}
);
var pSimTime = xmlDoc.evaluate('//organ[@type="seed" and @subType="0"]/parameter[@name="simulationTime"]/@value', xmlDoc, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
Expand Down

0 comments on commit 1fd6ad4

Please sign in to comment.