Hello Stanislav … here’s code of the GRID:
Grid[2] = Layout[4].cells('b').attachGrid();
Grid[2].setImagePath('../dhtmlx/Grid/codebase/imgs/');
Grid[2].setIconsPath('../dhtmlx/Layout/imgs/');
Grid[2].setHeader("LP,Minuten,<span style='padding-left:8px'>Preis</span>, Menge,Bezeichnung,,Verstärker");
Grid[2].setInitWidths("30,59,58,60,198,25,25");
Grid[2].setColAlign("center,center,right,center,left,center,center");
Grid[2].setColTypes("ro,ro,edn,edn,ro,del_row,ro");
Grid[2].enableValidation(false, false, false, true, false, false, false);
Grid[2].setColValidators(",,,ValidNumeric,,,");
Grid[2].setColSorting("int,int,int,int,str,int,int");
Grid[2].setColumnColor("#FFBE7D,,,,,,");
Grid[2].setDateFormat('%d.%m.%Y');
Grid[2].setNumberFormat("€ 0,000.00",2,",",".");
Grid[2].enableEditEvents(true, false, false);
Grid[2].attachEvent("onEditCell", function(stage,rId,cInd,nValue,oValue){ if (cInd == 2) { return false; } else { return true; } });
Grid[2].attachEvent("onCellChanged", function(rId,cInd,nValue){ if (cInd == 3) { Gesamt_LP_errechnen(2,1); } });
Grid[2].attachEvent("onDrop", function(sId,tId,dId,sObj,tObj,sCol,tCol){
Gesamt_LP_errechnen(2,1);
Gesamt_LP_errechnen(2,2);
Mehraufwand_pruefen(2,0);
Abrechnung_pruefen(<?php echo $row_auftraege['wo_abt']; ?>,<?php echo $row_auftraege['folgeticket_id']; ?>,<?php echo $row_auftraege['wartung']; ?>,'<?php echo $row_auftraege['excel_date']; ?>','<?php echo $row_tk['id']; ?>','','','<?php echo $wo_typ; ?>',<?php echo $typ['um']; ?>);
});
Grid[2].attachEvent("onCheckbox", function(rId,cInd,state) {
switch (state) {
case false:
Grid[2].deleteRow(rId);
Gesamt_LP_errechnen(2,1);
Gesamt_LP_errechnen(2,2);
Abrechnung_pruefen(<?php echo $row_auftraege['wo_abt']; ?>,<?php echo $row_auftraege['folgeticket_id']; ?>,<?php echo $row_auftraege['wartung']; ?>,'<?php echo $row_auftraege['excel_date']; ?>','<?php echo $row_tk['id']; ?>','','','<?php echo $wo_typ; ?>',<?php echo $typ['um']; ?>);
break;
}
});
Grid[2].attachEvent("onValidationError", function(id, ind, value) {
if (Form[5].getItemValue('field7_1').search(/Leistungspositionen - Die Mengenangabe ist unzu.+/) == -1) {
if (Form[5].getItemValue('field7_1') == "") { var neu = ""; } else { var neu = "\n"; }
Form[5].setItemValue('field7_1', Form[5].getItemValue('field7_1') + neu + unescape("(!) Leistungspositionen - Die Mengenangabe ist unzul%E4ssig"));
}
return true;
});
Grid[2].attachEvent("onValidationCorrect", function(id, ind, value) {
if (Form[5].getItemValue('field7_1') == "") { var neu = ""; } else { var neu = "\n"; }
Form[5].setItemValue('field7_1', Form[5].getItemValue('field7_1') + neu + "OK-LP");
Abrechnung_pruefen(<?php echo $row_auftraege['wo_abt']; ?>,<?php echo $row_auftraege['folgeticket_id']; ?>,<?php echo $row_auftraege['wartung']; ?>,'<?php echo $row_auftraege['excel_date']; ?>','<?php echo $row_tk['id']; ?>','','','<?php echo $wo_typ; ?>',<?php echo $typ['um']; ?>);
});
Grid[2].enableDragAndDrop(true);
Grid[2].enableMercyDrag(true);
Grid[2].init();
Grid[2].setColumnHidden(6,true);
Grid[2].setSkin("dhx_skyblue");
Grid[2].loadXML("../dhtmlx/Data/XML/grid.php?id=43&wonr=<?php echo $wonr; ?>");
DataProcessor[1] = new dataProcessor("../dhtmlx/Data/XML/grid.php?id=15&merker=1&wonr=<?php echo $wonr; ?>");
DataProcessor[1].setTransactionMode("POST", true);
DataProcessor[1].setUpdateMode("off");
DataProcessor[1].styles = {
updated: "font-weight:normal; color:#000; text-decoration:none;",
inserted: "font-weight:normal; color:#000; text-decoration:none;",
invalid: "font-weight:normal; color:#900; text-decoration:none;",
error: "font-weight:normal; color:#900; text-decoration:none;",
clear: "font-weight:normal; color:#000; text-decoration:none;"};
DataProcessor[1].init(Grid[2]);
Here is PHP Code for loading Data:
if($_GET['id'] == "43") {
header("Content-type: text/xml");
echo('<?xml version="1.0" encoding="ISO-8859-1"?>');
echo '<rows>';
$zaehler = 0;
$result = mysql_query("SELECT ablp_lp,ablp_zeit,ablp_preis,ablp_menge,lp_bez FROM sk_abr_lp AS A INNER JOIN sk_lp AS B ON A.ablp_lp = B.lp_id WHERE A.ablp_wonr = '".$_GET['wonr']."'");
while($felder = mysql_fetch_assoc($result)) {
$zaehler++;
echo ("<row id='".$zaehler."'>");
print("<cell><![CDATA[".$felder['ablp_lp']."]]></cell>");
print("<cell><![CDATA[".$felder['ablp_zeit']."]]></cell>");
print("<cell><![CDATA[".$felder['ablp_preis']."]]></cell>");
print("<cell><![CDATA[".$felder['ablp_menge']."]]></cell>");
print("<cell><![CDATA[ ".$felder['lp_bez']."]]></cell>");
print("<cell><![CDATA[1]]></cell>");
print("<cell><![CDATA[1]]></cell>");
echo("</row>");
}
echo '</rows>';
}
Tank you