Hello
I prepared a demo link:
https://www.mds.umdispotool.de/um_freigabe.php?a=1
Grid - Code:
<?php
require_once('../host/config_sql.php');
$firma = $_COOKIE["Firma"];
$user = $_COOKIE["Benutzer"];
$window = $_GET['a'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>UM Freigabe</title>
<link href="dhtmlx/Grid/codebase/dhtmlxgrid.css" rel="stylesheet" type="text/css">
<link href="dhtmlx/Grid/codebase/ext/dhtmlxgrid_pgn_bricks.css" rel="stylesheet" type="text/css">
<link href="dhtmlx/Grid/codebase/skins/dhtmlxgrid_dhx_skyblue.css" rel="stylesheet" type="text/css">
<link href="dhtmlx/Toolbar/skins/dhtmlxtoolbar_dhx_skyblue.css" rel="stylesheet" type="text/css">
<script>_css_prefix = "dhtmlx/Grid/codebase/";</script>
<script src="js/wawi.js"></script>
<script src="js/toolbar.js"></script>
<script src="dhtmlx/Toolbar/dhtmlxcommon.js"></script>
<script src="dhtmlx/Toolbar/dhtmlxtoolbar.js"></script>
<script src="dhtmlx/Grid/codebase/dhtmlxcommon.js"></script>
<script src="dhtmlx/Grid/codebase/dhtmlxgrid.js"></script>
<script src="dhtmlx/Grid/codebase/dhtmlxgridcell.js"></script>
<script src="dhtmlx/Grid/codebase/excells/dhtmlxgrid_excell_grid.js"></script>
<script src="dhtmlx/Grid/codebase/excells/dhtmlxgrid_excell_um.js"></script>
<script src="dhtmlx/Grid/codebase/ext/dhtmlxgrid_filter.js" type="text/javascript"></script>
<script src="dhtmlx/Grid/codebase/ext/dhtmlxgrid_export.js"></script>
<script src="dhtmlx/Grid/codebase/ext/dhtmlxgrid_nxml.js"></script>
<script src="dhtmlx/Grid/codebase/ext/dhtmlxgrid_pgn.js"></script>
<script src="dhtmlx/DataProcessor/dhtmlxdataprocessor.js"></script>
<style>
html, body {width: 100%; height: 100%; margin: 0px; overflow: hidden; background-color:white;}
.grid_hover {background-color:#9CC;font-size:20px;}
.rows_even {background-color:#DFEFFF;}
.rows_uneven {background-color:#FFFFF0;}
</style>
</head>
<body id="fullscreen">
<div id="lock" style="width:100%;height:100%;position:absolute;display:none;background-color:silver;opacity:0.4;-mo-opacity:0.4;filter:alpha(opacity=40);z-index:1"> </div>
<div id="toolbarbox"></div>
<div style="position:relative; height:99%; width:98%">
<div id="gridbox" style="width: 100%; height: 91%; background-color: white; overflow:hidden;"></div>
<div id="paging" style="padding-top:7px"></div>
<div id="loading" style="position:absolute; top:310px; left:625px; height:20px; widht:130px;"><img src="dhtmlx/Grid/codebase/imgs/loading.gif" width="128" height="15" /></div>
</div>
<script type="text/javascript">
Grid = new Array();
first_row = 0;
last_row = 30;
var Toolbar = new dhtmlXToolbarObject("toolbarbox", "dhx_black");
Toolbar.setIconsPath("images/icons/");
Toolbar.setSkin('dhx_skyblue');
Toolbar.addButton("reset", 0, "Neu laden", "Sync.png", "");
Toolbar.addButton("select_all", 1, "ganze Seite auswählen", "Script.png", "");
Toolbar.addButton("speichern", 2, "Speichern", "save.gif", "save_dis.gif");
Toolbar.addButton("print", 3, "Drucken", "print.gif", "print_dis.gif");
Toolbar.addButton("excel2", 4, "Excel", "excel.png", "excel.png");
Toolbar.addButton("close", 5, "Schliessen", "Exit.png", "Exit.png");
Toolbar.addSeparator("s1", 2);
Toolbar.addSeparator("s1", 4);
Toolbar.addSeparator("s1", 7);
Toolbar.attachEvent("onClick", function(id) {
switch (id) {
case "reset":
Grid[1].clearAll();
Grid[1].loadXML("dhtmlx/Data/XML/grid.php?id=16");
break;
case "select_all":
for (var i = first_row; i <= last_row; i++) {
Grid[1].cells2(i,12).setValue(true);
DataProcessor.setUpdated(i,true);
Grid[1].forEachCell(i, function(cellObj,ind){
Grid[1].setCellTextStyle(Grid[1].getRowId(i-1),ind,"background-color:#99E597");
});
}
break;
case "speichern":
DataProcessor.sendData();
break;
default:
Button_laden(id,1,1,'<?php echo $window; ?>',1,'',<?php echo $user; ?>);
break;
}
});
Grid[1] = new dhtmlXGridObject('gridbox');
Grid[1].setImagePath("dhtmlx/Grid/codebase/imgs/");
Grid[1].setHeader("<span style='padding-left:2px'>WOINT</span>,WOINT,<span style='padding-left:6px'>WOUM</span>,Typ,<span style='padding-left:16px'>Termin</span>,<span style='padding-left:14px'>Techniker</span>,S-Code,<span style='padding-left:14px'>KST</span>,<span style='padding-left:39px'>Material</span>,<span style='padding-left:47px'>LP</span>,<span style='padding-left:33px'>POS 7</span>,<span style='padding-left:100px'>ausgeführte Arbeiten</span>,");
Grid[1].attachHeader("#numeric_filter,#numeric_filter,#numeric_filter,#select_filter,#text_filter,#select_filter,#text_filter,#select_filter,#text_filter,#text_filter,#text_filter,#text_filter");
Grid[1].setInitWidths("60,60,70,42,95,110,60,70,160,130,140,*,30");
Grid[1].setColAlign("center,center,center,center,center,center,center,center,left,left,left,left,center");
Grid[1].setColTypes("ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,banf");
Grid[1].setColSorting("int,int,int,str,str,str,str,str,str,str,str,str,int");
Grid[1].enableTooltips("false,false,false,false,false,false,false,false,true,true,true,true,false");
Grid[1].enableRowsHover(true, 'grid_hover');
Grid[1].attachEvent("onXLS", function() { document.getElementById('loading').style.display = 'block'; });
Grid[1].attachEvent("onXLE", function() { document.getElementById('loading').style.display = 'none'; });
Grid[1].attachEvent("onMouseOver", function(id,ind) {
if (ind == 12) {this.cells(id,ind).cell.title = 'Auftrag freigeben';}
});
Grid[1].attachEvent("onPageChanged", function(ind,fInd,lInd){
first_row = fInd+1;
last_row = lInd;
});
Grid[1].attachEvent("onCheckbox", function(rId,cInd,state){
if (state == true) {
Grid[1].forEachCell(rId, function(cellObj,ind){
Grid[1].setCellTextStyle(Grid[1].getRowId(rId-1),ind,"background-color:#99E597");
});
}
});
Grid[1].enablePaging(true, 30, 10, "paging", true);
Grid[1].enableMultiline(true);
Grid[1].setPagingSkin("bricks");
Grid[1].setSkin("clear");
Grid[1].init();
Grid[1].setColumnHidden(1,true);
Grid[1].enableAlterCss("rows_even", "rows_uneven");
Grid[1].loadXML("dhtmlx/Data/XML/grid.php?id=16");
DataProcessor = new dataProcessor("dhtmlx/Data/XML/grid.php?id=34");
DataProcessor.setTransactionMode("POST", true);
DataProcessor.setUpdateMode("off");
DataProcessor.attachEvent("onBeforeDataSending",function(id){
document.getElementById("lock").style.display = "block";
document.getElementById('loading').style.display = 'block';
return true;
});
DataProcessor.attachEvent("onFullSync",function(){
Grid[1].clearAll();
Grid[1].loadXML("dhtmlx/Data/XML/grid.php?id=16");
setTimeout("alert('Die markierten Aufträge wurden erfolgreich freigegeben !'); document.getElementById('loading').style.display = 'none'; document.getElementById('lock').style.display = 'none';",2500);
});
DataProcessor.styles = {
updated: "font-weight:normal;",
inserted: "font-weight:normal;",
deleted: "font-weight:normal;text-decoration: line-through",
invalid: "background-color:#900; color:white;",
error: "background-color:#900; color:white;",
clear: "font-weight:normal; color:black; text-decoration:none;"};
DataProcessor.init(Grid[1]);
</script>
</body>
</html>
dataprocessor - grid.php
if($_GET['id'] == "34") {
function add_row($rowId){
global $newId;
if ($_POST[$rowId."_c12"] == true) {
mysql_query("UPDATE sk_auftraege SET webtool = '1' WHERE wonr_intern = '".$_POST[$rowId."_c1"]."'");
}
return "insert";
}
header("Content-type: text/xml");
echo('<?xml version="1.0" encoding="iso-8859-1"?>');
echo "<data>";
$ids = explode(",",$_POST["ids"]);
for ($i = 0; $i < sizeof($ids); $i++) {
$rowId = $ids[$i];
$newId = $rowId;
$mode = $_POST[$rowId."_!nativeeditor_status"];
$action = add_row($rowId);
echo "<action type='".$action."' sid='".$rowId."' tid='".$newId."'/>";
}
echo "</data>";
}
Thank you in advance
Best regards
Oliver