Hallo zusammen,
stehe gerade etwas auf dem „Schlauch“
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 …
Grüße,
Hermann