Hi Miol
You can add an attribute to a table parameter (provided it is backed by an INT16/INT32 and not an INT16_ARRAY/INT32_ARRAY) to provide a drag-to-reorder handle. If you would also like up/down buttons, you can use the example posted below to see how to shuffle the parameter values around:
<abs contexttype="opengear">
<meta>
<params>
<param access="1" constrainttype="STRING_CHOICE" name="Table" oid="params.table" precision="0" type="INT16" value="2" widget="table">
<constraint>value_param</constraint>
</param>
<param access="1" maxlength="0" name="Values" oid="value_param" precision="0" type="STRING_ARRAY" widget="default">
<value>a</value>
<value>b</value>
<value>c</value>
<value>d</value>
<value>e</value>
<value>f</value>
<value>g</value>
</param>
</params>
<api>function moveUp()
{
move(-1);
}
function moveDown()
{
move(1);
}
function move(direction)
{
var selection = params.getValue('params.table', 0);
var newSelection = selection + direction;
if (newSelection < 0 || newSelection > params.getElementCount('value_param'))
{
return; //If we are moving up but are already at the top or moving down and are already at the bottom
}
var newValues = [];
var oldValues = params.getAllValues('value_param');
for (var i = 0; i < oldValues.length; i++)
{
if (direction > 0 && i != selection) //If we are down, add the value already at index first
{
newValues.push(oldValues[i]);
}
if (i == newSelection)
{
newValues.push(oldValues[selection]);
}
if (direction < 0 && i != selection) //If we are up, add the value already at index after
{
newValues.push(oldValues[i]);
}
}
params.setAllValues('value_param', newValues);
params.setValue('params.table', 0, newSelection);
}
</api>
</meta>
<param expand="true" height="268" left="17" oid="params.table" showlabel="false" top="18" width="174">
<config key="w.reorder">true</config>
</param>
<button buttontype="push" height="54" left="206" name="Move Up" top="34" width="145">
<task tasktype="ogscript">moveUp();</task>
</button>
<button buttontype="push" height="54" left="208" name="Move Down" top="93" width="145">
<task tasktype="ogscript">moveDown();</task>
</button>
</abs>
#DashBoard