Hi Erik.
The issue you are experiencing is because the parameter entries do not exist at the time your panel is loaded. If you add new elements to your struct and want to show them in the UI, you will need to reload that part of the UI.
The only time you wouldn't is if you are showing the entire struct as a table parameter - this may be the best option for you.
Another issue you will experience with your panel:
If you add an entry to a struct without all sub-OIDs, the sub-OIDs that were not defined in your new entry will be removed. There is an option to turn this feature off by making your parameter 'additive'. I'm attaching an example that shows displaying your struct as a table parameter instead of a <table/> tag and uses the 'additive' feature to retain all sub-OIDs.
<abs contexttype="opengear" id="_top">
<meta>
<api immediate="true">function checkLookup() {
for (var i = 0; i < params.getElementCount("dstList"); i++) {
ogscript.debug(i + " rtr: " + params.getValue("dstList."+i+".rtr",0));
ogscript.debug(i + " vd: " + params.getValue("dstList."+i+".vd",0));
ogscript.debug(i + " ac: " + params.getValue("dstList."+i+".ac",0));
ogscript.debug(i + " vs: " + params.getValue("dstList."+i+".vs",0));
}
}
function buildLookup()
{
ogscript.debug("in size " + params.getElementCount("dstList"));
var dests = [
[1,59,2],
[1,60,0]
];
for (var i = 0; i < dests.length; i++)
{
params.setValue("dstList", i, {"rtr": parseInt(dests[i][0]), "vd": parseInt(dests[i][1]), "ac": parseInt(dests[i][2])});
if ((parseInt(dests[i][2]) > 0) && (parseInt(dests[i][0]) == 1))
{
params.setValue("dstList", i, {"a1d": parseInt(dests[i][3]),"a2d": parseInt(dests[i][4])});
}
}
ogscript.debug("out size " + params.getElementCount("dstList"));
}
function updateSRC() {
for (var i = 0; i < params.getElementCount("dstList"); i++) {
ogscript.debug('updateSRC ' + i);
params.setValue("dstList",i, {"vs" : "Test " + i});
}
}</api>
<params>
<param access="1" constrainttype="STRUCT" name="Router Destination Info Template" oid="dstListTemplate" structtype="dstListTemplate" type="STRUCT" widget="table">
<config key="p.additive">true</config>
<value>
<subparam access="1" constraingtype="INT_NULL" name="Router" precision="0" suboid="rtr" type="INT16" value="0" widget="default"/>
<subparam access="1" constrainttype="INT_NULL" name="Video Destination" precision="0" suboid="vd" type="INT16" value="0" widget="default"/>
<subparam access="1" constrainttype="INT_NULL" name="Audio Channels" precision="0" suboid="ac" type="INT16" value="0" widget="default"/>
<subparam access="1" maxlength="-1" name="Video Source" stateless="true" suboid="vs" type="STRING" value="None" widget="default"/>
</value>
</param>
<param access="1" constrainttype="STRUCT" name="Router Destination Info" oid="dstList" stateless="true" structtype="dstListTemplate" templateoid="dstListTemplate" type="STRUCT_ARRAY" widget="table"/>
</params>
<context contexttype="opengear" id="Ultrix.1" objectid="Ultrix-50198224007<br>Slot 0<br>Ultrix" objecttype="Ultrix"/>
</meta>
<button buttontype="push" height="40" left="10" name="Build" top="10" width="100">
<task tasktype="ogscript">buildLookup();</task>
</button>
<button buttontype="push" height="40" left="120" name="Update" top="10" width="100">
<task tasktype="ogscript">updateSRC();</task>
</button>
<button buttontype="push" height="40" left="230" name="Check" top="10" width="100">
<task tasktype="ogscript">checkLookup();</task>
</button>
<table left="10" top="60">
<tr>
<blank height="40" width="40"/>
<label name="Source 1" style="txt-align:center" width="200"/>
<label name="Source 2" style="txt-align:center" width="200"/>
</tr>
<tr>
<label height="40" name="rtr" style="txt-align:center"/>
<param element="0" expand="true" oid="dstList.0.rtr" widget="1"/>
<param element="0" expand="true" oid="dstList.1.rtr" widget="1"/>
</tr>
<tr>
<label height="40" name="vd" style="txt-align:center"/>
<param element="0" expand="true" oid="dstList.0.vd" widget="1"/>
<param element="0" expand="true" oid="dstList.1.vd" widget="1"/>a</tr>
<tr>
<label height="40" name="ac" style="txt-align:center"/>
<param element="0" expand="true" oid="dstList.0.ac" widget="1"/>
<param element="0" expand="true" oid="dstList.1.ac" widget="1"/>
</tr>
<tr>
<label height="40" name="vs" style="txt-align:center"/>
<param element="0" expand="true" oid="dstList.0.vs" widget="1"/>
<param element="0" expand="true" oid="dstList.1.vs" widget="1"/>
</tr>
</table>
<param expand="true" height="255" left="90" oid="dstList" showlabel="false" top="358" width="763"/>
</abs>
#DashBoard