I’m using dhtmlxSuite 2012 Rel.1 (DHTMLX 3.5) Professional edition build 120822 and dhtmlxScheduler PRO v.3.7 build 130220 and I’m having trouble making my grid edits push to the server. When I edit a field in the grid, it updates in the grid but the changes don’t get saved. Here’s what the debugger displays:
My Connector code: [code] <?php
require(“codebase/connector/grid_connector.php”);
//set content type and xml tag
header("Content-Type: text/xml");
ob_clean();
print(“<?xml version='1.0' encoding='utf-8' ?>”);
require_once(‘mysql.php’);
session_start();
$username = $_SESSION['username'];
if(empty($username))
{
header("Location: login/");
exit();
}
else
{
//Record counts
$userid = $_SESSION['userid'];
}
//define variables from incoming values
if(isset($_GET["posStart"]))
$posStart = $_GET['posStart'];
else
$posStart = 0;
if(isset($_GET["count"]))
$count = $_GET['count'];
else
$count = 20;
//connect to database
$link = mysql_pconnect("localhost", "clwebdev", "clwebdev");
$db = mysql_select_db ("cloudDb");
//create query to products table
$sql = "SELECT * FROM Contacts WHERE UserId='$userid'";
//if this is the first query - get total number of records in the query result
if($posStart==0){
$sqlCount = "Select count(*) as cnt from ($sql) as tbl";
$resCount = mysql_query ($sqlCount);
$rowCount=mysql_fetch_array($resCount);
$totalCount = $rowCount["cnt"];
}
$columns = array("Company","Category","Phone1");
$sql.=" Order by Category ASC";
//add limits to query to get only rows necessary for the output
//$sql.= " LIMIT ".$posStart.",".$count;
//query database to retrieve necessary block of data
$res = mysql_query ($sql);
$lastCategory = “”;
$rowId = 0;
//output data in XML format
print("<rows>");
while($row=mysql_fetch_array($res))
{
print("<row id='".$row['Id']."' onClick='get();'>");
print("<cell>");
print("<![CDATA[". $row['Category'] . "]]>");
print("</cell>");
print("<cell>");
print("<![CDATA[". $row['Company'] . "]]>");
print("</cell>");
print("<cell>");
print("<![CDATA[" . $row['Title'] . "]]>");
print("</cell>");
print("<cell><![CDATA[" . $row['Department'] . "]]></cell>");
print("<cell><![CDATA[" . $row['First'] . "]]></cell>");
print("<cell><![CDATA[" . $row['Last'] . "]]></cell>");
print("<cell><![CDATA[" . $row['Phone1'] . "]]></cell>");
print("<cell><![CDATA[" . $row['Phone2'] . "]]></cell>");
print("<cell><![CDATA[" . $row['Phone3'] . "]]></cell>");
print("<cell><![CDATA[" . $row['Email1'] . "]]></cell>");
print("<cell><![CDATA[" . $row['Email2'] . "]]></cell>");
print("<cell><![CDATA[" . $row['Address1'] . "]]></cell>");
print("<cell><![CDATA[" . $row['City1'] . "]]></cell>");
print("<cell><![CDATA[" . $row['State1'] . "]]></cell>");
print("<cell><![CDATA[" . $row['Zip1'] . "]]></cell>");
print("<cell><![CDATA[" . $row['Country1'] . "]]></cell>");
print("<cell><![CDATA[" . $row['Url1'] . "]]></cell>");
print("<cell><![CDATA[" . $row['Url2'] . "]]></cell>");
print("<cell><![CDATA[" . $row['Birthday'] . "]]></cell>");
print("<cell><![CDATA[" . $row['Spouse'] . "]]></cell>");
print("<cell><![CDATA[" . $row['Children'] . "]]></cell>");
print("<cell><![CDATA[" . $row['Anniversary'] . "]]></cell>");
print("<cell><![CDATA[" . $row['Note'] . "]]></cell>");
print("</row>\n");
}
if($rowId > 0)
print(“”);
print("</rows>");
?>
[/code]
And my grid:
[code]grid1 = layout1.cells(“a”).attachGrid();
//grid1.selMultiRows = true;
grid1.imgURL = “codebase/imgs/icons_greenfolders/”;
grid1.setHeader(“Category,{#collapse}3:Company,Job Title,Department,First Name,Last Name,{#collapse}3:Work Phone,Mobile Phone,Home Phone,{#collapse}2:Personal Email,Work Email,{#collapse}5:Street Address,City,State,Zip Code,Country,{#collapse}2:Primary Website,Secondary Website,Birthday,{#collapse}3:Spouse,Children,Anniversary,Notes”);
grid1.setColumnIds(“category,company,job_title,department,first_name,last_name,work,mobile,home,email,email_2,home_street,home_city,home_zip_code,home_country,website,website_2,birthday,spouse,children,anniversary,note”);
grid1.setInitWidths(“150,150,150,150,150,150,150,150,150,150,150,150,150,50,50,150,150,150,100,150,250,100,350”)
grid1.setColAlign(“left,left,left,left,left,left,left,left,left,left,left,left,left,left,left,left,left,left,left,left,left,left,left”)
grid1.setColTypes(“ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,txt”);
grid1.setColSorting(“str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str”);
grid1.customGroupFormat = function(text, count) {
return "There are " + count + " records in " + text;//Counts
}; grid1.enableEditEvents(false,true,true);//test
grid1.attachEvent("onRowSelect",doOnRowSelected);
grid1.attachEvent("onBeforeRowDeleted",doBeforeRowDeleted);
grid1.attachEvent("onDblClicked",function(){
grid1.selectCell(rowIndex,cellIndex);
grid1.editCell();
grid1.save();});
grid1.enableOrderSaving();
grid1.attachEvent("onAfterCMove", function(cInd, posInd){
grid1.saveOrderToCookie();});
grid1.enableColumnMove(true);
grid1.enableAutoSaving();
grid1.init();
grid1.setSkin("dhx_web")
grid1.groupBy(0);
grid1.enableAlterCss("even_row","odd_row");
grid1.load("contactsCategory.php", function(){
grid1.loadOrderFromCookie();});
grid1.enableHeaderMenu();
grid1.collapseColumns(1);
grid1.collapseColumns(6);
grid1.collapseColumns(9);
grid1.collapseColumns(11);
grid1.collapseColumns(16);
grid1.collapseColumns(19);
[/code]
And, finally, DataProcessor: var dp1 = new dataProcessor("contactsCategory.php");
dp1.init(grid1);
dp1.enableDataNames(true);
dp1.sendData();
Any help fixing this would be appreciated. Thanks!