Saving doesn't work

Hello

I’m using Grid 3.5 Pro / Connector 1.5
I try to load a Grid data (works) and want that any change inside the grid will take effect serverside. I tried to connect with Connector but nothing will work. Can somebody help me please … where is my mistake ?!

Init

      <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">

      <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_onoff.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_undo.js"></script>
      <script src="../../../dhtmlx/Grid/codebase/ext/dhtmlxgrid_hmenu.js"></script>
      <script src="../../../dhtmlx/Connector/connector.js"></script>
      <script src="../../../dhtmlx/DataProcessor/dhtmlxdataprocessor.js"></script>

Grid

       Grid[1] = new dhtmlXGridObject('gridbox');
		 Grid[1].setImagePath("../../../dhtmlx/Grid/codebase/imgs/");
		        Grid[1].setHeader("Mitarbeiter,Shoutbox,&nbsp;&nbsp;Objekt<br>Warnung,&nbsp;Anlagen<br>Warnung,&nbsp;Ersatz-<br>auftrag,WONR<br>&nbsp;View,&nbsp;WONR<br>X-View,Termin-<br>&nbsp;planer,WONR<br>&nbsp;Block,Memo,&nbsp;ausgef.<br>Arbeiten,F2CM,WONR<br>Reset,News,Pegel-<br>werte");
		 Grid[1].setInitWidths("*,75,72,72,65,55,60,65,55,55,70,55,55,55,60");
Grid[1].setColAlign("left,center,center,center,center,center,center,center,center,center,center,center,center,center,center");
		 Grid[1].setColTypes("ed,onoff,onoff,onoff,onoff,onoff,onoff,onoff,onoff,onoff,onoff,onoff,onoff,onoff,onoff");
		 Grid[1].setColSorting("str,int,int,int,int,int,int,int,int,int,int,int,int,int,int");
		 Grid[1].enableTooltips("false,false,false,false,false,false,false,false,false,false,false,false,false,false,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].setSkin("light");
			
	     Grid[1].init();
	     Grid[1].enableLightMouseNavigation(false);
	     Grid[1].enableHeaderMenu();
		  Grid[1].enableUndoRedo();
	     Grid[1].enableAlterCss("rows_even", "rows_uneven");
		  Grid[1].load("test.php");
		 
		  var DataProcessor = new dataProcessor("test.php");			
		  DataProcessor.init(Grid[1]);

test.php

<?php
   include ('../../../dhtmlx/Connector/grid_connector.php');
   include ('../../../dhtmlx/Data/SQL/config.php');
   
   $res = mysql_connect($mysql_host, $mysql_user, $mysql_pasw);
   mysql_select_db($mysql_db);
  
   $conn = new GridConnector($res, "MySQL");
   $conn->enable_log("temp.log");
 
   $conn->dynamic_loading(100);
$conn->render_table("sk_module","id","mod_user,mod_shoutbox,mod_owarnung,mod_awarnung,mod_ersatzauftrag,mod_wonr_historie,mod_wonr_overview,mod_wonr_overview_admin,mod_terminplaner,mod_blockieren,mod_memo,mod_aarbeiten,mod_f2_cablemaster,mod_zuruecksetzen,mod_news,mod_pegelwerte");
?>

Thank you

Best regards

Oli

Change the order of includes

  <script src="../../../dhtmlx/DataProcessor/dhtmlxdataprocessor.js"></script>
  <script src="../../../dhtmlx/Connector/connector.js"></script>

connector must go after js files

Damn … silly mistake …

Thank you :slight_smile:

Hello,

I’m having the same problem. I can populate my grid with data but the changes I make on the data are not saved…
I have the includes on the right order.
What am I missing? Here is my code below.
Thank you for your help.

test.htm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<style>
			html, body {
				width: 100%;
				height: 100%;
				margin: 0px;
				overflow: hidden;
				background-color:white;
			}
		</style>
		<link rel="STYLESHEET" type="text/css" href="codebase/dhtmlxgrid.css">
		<link rel="STYLESHEET" type="text/css" href="codebase/dhtmlx.css">
		<script src="codebase/dhtmlx.js"></script>
		<script src="codebase/dhtmlxcommon.js"></script>
		<script src="codebase/dhtmlxgrid.js"></script>
		<script src="codebase/dhtmlxgridcell.js"></script>
		<script src="codebase/dataprocessor/dhtmlxdataprocessor.js"></script>
		<script src="codebase/connector/connector.js"></script>
		<script>
			var mygrid;
			function doInitGrid(){
				mygrid = new dhtmlXGridObject('mygrid_container');
				mygrid.setImagePath("codebase/imgs/");
				mygrid.setHeader("ID,Lib");
				mygrid.setInitWidths("*,150");
				mygrid.setColAlign("left,right");
				mygrid.setSkin("light");
				mygrid.setColSorting("str,str");
				mygrid.setColTypes("ed,ed");
				mygrid.init();
				
				mygrid.loadXML("xml/db.php");
				
				var myDataProcessor = new dataProcessor("xml/db.php");
				myDataProcessor.init(mygrid); //link dataprocessor to the grid
			}
		</script>
	</head>
	<body onload="doInitGrid()">
		<div id="mygrid_container" style="width:600px;height:150px;"></div>
	</body>
</html>

db.php

<?php

	include("../codebase/connector/grid_connector.php");
	include ('../codebase/connector/db_sqlsrv.php');
	
	$serverName = 'server';
    $connectionInfo = array("Database"=>"database", "UID"=>"user", "PWD"=>"password");
	$res = sqlsrv_connect($serverName, $connectionInfo);
	
	$grid  = new GridConnector($res,"SQLSrv");
	$grid->render_table("etat","etat_id","etat_id,etat_lib");

?>

You are including dhtmlx.js on the page, and after that include each file separately, which is basically the same code. Try to use or dhtmlx.js + connector.js or separate js files ( all, without dhtmlx.js )

If problem still occurs - please try to enable the server side logging.
docs.dhtmlx.com/doku.php?id=dhtm … de_logging

I enabled the server side logging and I’ve been able to understand my mistake. It was trying to update the ID of the table…
Thank you Stanislav.