Ich habe das mal mit folgendem Formular getestet. Wie es scheint, wird die Variable $List zwar gesetzt, sie ist aber leer ( im Feld List dump steht: null).
Die Werte werden aber korrekt in der Property gespeichert und über den Button „Show List“ angezeigt.
{
"elements": [
{
"caption": "List with dynamic Form",
"type": "List",
"name": "List",
"add": true,
"delete": true,
"rowCount": 5,
"columns": [
{
"caption": "Type",
"name": "Type",
"width": "500px",
"edit": {
"type": "Select",
"options": [
{ "caption": "Variable", "value": 0 },
{ "caption": "Value", "value": 1 }
]
},
"add": 0
}
],
"values": [
],
"form": [
"$form = [];",
"$form[] = [",
" 'type'=> 'Select',",
" 'name'=> 'Type',",
" 'caption'=> 'Type',",
" 'options'=> [",
" ['caption' => 'Variable', 'value'=> 0 ],",
" ['caption' => 'Value', 'value' => 1 ]",
" ]",
"];",
"if (isset($List['Type']) && $List['Type'] == 0 ) {",
" $form[] = [",
" 'type'=> 'SelectVariable',",
" 'name'=> 'VariableID',",
" 'caption'=> 'VariableID'",
" ];",
"}",
" $form[] = [",
" 'type'=> 'NumberSpinner',",
" 'name'=> 'Value',",
" 'caption'=> 'Value'",
" ];",
"if (isset($List)) {",
" $form[] = [",
" 'type'=> 'ValidationTextBox',",
" 'caption'=> 'List dump',",
" 'value' => json_encode($List)",
" ];",
"}",
"return $form;"
]
},
{
"type": "Button",
"caption": "Show List",
"onClick": "echo IPS_GetProperty($id, 'List');"
}
],
"actions": [],
"status": []
}