Hello everybody,
I tried to code an own RIA, basend on the demo “WebAppsToday”, but the dataprocessor will not work. I try to understand, how does it work, but I am a newbee in coding javascript. This is my code
JavaScript
dhxWins = new dhtmlXWindows();
// Layout
ablLayout = new dhtmlXLayoutObject(document.body, "1C");
ablLayout.cells("a").setText("Auftragsbestandsliste");
// Grid Master
ablGridMaster = ablLayout.cells("a").attachGrid();
ablGridMaster.setImagePath("../../dhtmlx/imgs/");
ablGridMaster.setHeader("Kommission,NeubauNr,Kunde,Liefertermin,KW,Auftragsart,Bestellung,Beschreibung");
ablGridMaster.attachHeader("#text_filter,#text_filter,#select_filter,#text_filter,#select_filter,#select_filter, ,, ");
ablGridMaster.setInitWidths("75,120,150,80,90,150,*,*");
ablGridMaster.setColAlign("right,left,left,right,right,left,left,left");
ablGridMaster.setColTypes("ro,ro,ro,ro,ro,ro,ro,ro");
ablGridMaster.setColSorting("int,str,str,date,str,str,str,str");
ablGridMaster.enableMultiline(true);
ablGridMaster.init();
ablGridMaster.loadXML("master.xml");
ablGridMaster.attachEvent("onRowDblClicked", function (rID,cInd){
if(!dhxWins.window("ablDetailsWin")){
win = dhxWins.createWindow("ablDetailsWin",20,20,900,600);
win.center();
win.attachEvent("onClose",function(){
win.hide;
return true;
});
}
else
win.show("ablDetailsWin");
dhxWins.window("ablDetailsWin").setText("Auftrag "+rID);
ablAccordion = win.attachAccordion(rID,cInd);
ablAccordion.addItem("a1", "Auftrag");
ablAccordion.addItem("a2", "Vertrieb");
ablAccordion.addItem("a3", "Vertriebsabwicklung");
ablAccordion.addItem("a4", "m. Konstruktion");
ablAccordion.addItem("a5", "e. Konstruktion");
ablAccordion.openItem("a1");
// Form Auftrag
auftragForm = ablAccordion.cells("a1").attachForm();
auftragForm.loadStruct("auftragForm.xml");
auftragForm.load("auftragDetails.php?id="+rID);
// Form Vertrieb
vertriebForm = ablAccordion.cells("a2").attachForm();
vertriebForm.loadStruct("vertriebForm.xml");
vertriebForm.load("vertriebDetails.php?id="+rID);
// Form Vertriebsabwicklung
vertriebsabwicklungForm = ablAccordion.cells("a3").attachForm();
vertriebsabwicklungForm.loadStruct("vertriebsabwicklungForm.xml");
vertriebsabwicklungForm.load("vertriebsabwicklungDetails.php?id="+rID);
// DP Auftrag
var dpf_auftrag = new dataProcessor("auftragDetails.php");
dpf_vertrieb.init(auftragForm);
// DP Vertriebsabwicklung
var dpf_vertriebsabwicklung = new dataProcessor("vertriebsabwicklungDetails.php");
dpf_vertriebsabwicklung.init(vertriebsabwicklungForm);
vertriebsabwicklungForm.attachEvent("onButtonClick", function(name, command){
dpfs_vertriebsabwicklung.sendData();
});
});
PHP
<?php
require("../../dhtmlx/connector/form_connector.php");
$res=mysql_connect("localhost","root","xxxxxxxxxx");
mysql_select_db("besinet");
$formConn = new FormConnector($res);
$formConn->render_table("ablvertriebsabwicklung","BelegNummer","Auftragswert,geliefert,bezahlt,Restwert,Kuerzel,Art,Bemerkungen");
?>
xml Form
<?xml version="1.0"?>
<items>
<item type="input" name="Auftragswert" bind="Auftragswert" label="Auftragswert" width="150" rows="3"/>
<item type="input" name="geliefert" bind="geliefert" label="geliefert" width="150" rows="3"/>
<item type="input" name="bezahlt" bind="bezahlt" label="bezahlt" width="150" rows="3"/>
<item type="input" name="Restwert" bind="Restwert" label="Restwert" width="65"/>
<item type="input" name="Kuerzel" bind="Kuerzel" label="Kuerzel" width="55"/>
<item type="input" name="Art" bind="Art" label="Art" width="20"/>
<item type="input" name="Bemerkungen" bind="Bemerkungen" label="Bemerkungen" width="400" rows="5"/>
<item type="button" xcommand="save" value="Submit" />
</items>
Loading data from db to form works fine, but it is not possible to make an update. I think the form data will not send but I am not sure. Can anybody help me?
Kindly regards,
Daniel