Konfigurationsformulare Function "List"

Hallo zusammen,

stehe gerade etwas auf dem „Schlauch“ :confused:

Ich würde geren hinter jeder „Value“-Zeile einen Button „add Device“ haben. Ich habe ihn im Bild unten rot angemerkt.
Wie müsste mein „values“ - Array korrekt aussehen ?

 $arrayOWValues[] = array("Typ" => $OWDeviceArray[$i]['Typ'], "Id" => $OWDeviceArray[$i]['Id'], "Temp" => $OWDeviceArray[$i]['Temp'], "options" => array("type" => "Button", "caption" => "add Device", "onClick" => $this->AddOWNetDevice()));

Hier die ganze Skript-passage:

private function GetFormElements()
        {
            // $Connection_Type = $this->ReadPropertyString('Connection_Type');
            $formElements[] = [
                'type'    => 'Label',
                'caption' => $this->Translate('___ Options _______________________________________________________________________________________________________________')
            ];
            $formElements[] = [
                "type" => "CheckBox",
                "name" => "log",
                "caption" => $this->Translate("enable Logging")
            ];
            $formElements[] = [
                "type" => "CheckBox",
                "name" => "debug",
                "caption" => $this->Translate("enable debug messages")
            ];
            $formElements[] = [
                'type'    => 'Label',
                'caption' => $this->Translate('___ OWNet Client Socket Connection Parameters _____________________________________________________________________________')
            ];

            $formElements[] = [
                "type" => "ValidationTextBox",
                "name" => "Host",
                "caption" => $this->Translate("OWNet Host")
            ];
            $formElements[] = [
                "type" => "NumberSpinner",
                "name" => "Port",
                "caption" => $this->Translate("OWNet Port")
            ];

            $formElements[] = [
                'type'    => 'Label',
                'caption' => $this->Translate('___ OWNet Devices _________________________________________________________________________________________________________')
            ];

            $arraySort = array();
            $arraySort = array("column" => "Typ", "direction" => "ascending");
            // Tabelle für die gefundenen 1-Wire-Devices
            $arrayOWColumns = array();
            $arrayOWColumns[] = array("caption" => "Typ", "name" => "Typ", "width" => "70px", "add" => "");
            $arrayOWColumns[] = array("caption" => "Id", "name" => "Id", "width" => "130px", "add" => "");
            $arrayOWColumns[] = array("caption" => "Temp", "name" => "Temp", "width" => "60px", "add" => "");

            If ($this->GetBuffer("OW_Handle") == 0) {
                // 1-Wire-Devices einlesen und in das Values-Array kopieren
                $this->OWSearchStart();
            }
            $OWDeviceArray = json_decode($this->GetBuffer('OWDeviceArray'), true);
            If (count($OWDeviceArray) > 0 ) {
                $arrayOWValues = array();
                for ($i = 0; $i < Count($OWDeviceArray); $i++) {
                     $arrayOWValues[] = array("Typ" => $OWDeviceArray[$i]['Typ'], "Id" => $OWDeviceArray[$i]['Id'], "Temp" => $OWDeviceArray[$i]['Temp'], "options" => array("type" => "Button", "caption" => "add Device", "onClick" => $this->AddOWNetDevice()));
                }
                $formElements[] = array("type" => "List", "name" => "OWNet_Devices", "caption" => $this->Translate("OWNet Devices"), "rowCount" => 5, "add" => false, "delete" => false, "sort" => $arraySort, "columns" => $arrayOWColumns, "values" => $arrayOWValues);
            }
            else {
                $formElements[] = array("type" => "Label", "label" => $this->Translate("no 1-Wire devices found"));
            }

            return $formElements;
        }

Die SDK bringt mich nicht gerade weiter … :confused:
Grüße,
Hermann

Warum nicht?
Steht da doch :slight_smile:
https://www.symcon.de/service/dokumentation/entwicklerbereich/sdk-tools/sdk-php/konfigurationsformulare/list/#Parameter_für_edit
Zuerst muss add in der Liste auf true stehen, du hast false und dann musst du bei den columns auch das Objekt edit mit Form-Elementen angeben.
Dann erscheint der Hinzufügen Button von ganz allein.

Noch mal eine persönliche Meinung zu dieser Form.
Das schaut total falsch geplant aus.
Parameter eines IO werden im IO konfiguriert und nirgendwo anders. Wenn deine Liste ein Konfigurator darstellen soll, dann gehört das in eine eigene Instanz.
Auch die Auswahl des IO Typ hat idr nichts in einem Device/Splitter zu suchen, allerhöchsten wenn sich dadurch das Protokoll grundlegend ändert. Wie z.b. bei ModBus.
Auch das die ganze Form, inklusive statischen Teil im Code steht, anstatt in der form.json macht den Code nicht leserlicher. Das Übersetzen mit translate erfolgt automatisch bei der Form. Das musst du nicht selber im Code machen.
Michael