Can't get dataprocessor to update server

I am using several dhtmlx components on my webpage with a lot of success, except the dataprocessor.

Here is how I instantiated the grid and dataprocessor:

 <head>
        <!-- Include styles for dhtmlx objects and custom styles for the header bar -->
        <link rel="stylesheet" type="text/css" href="dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid.css">
        <link rel="stylesheet" type="text/css" href="dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid_skins.css">
        <link rel="stylesheet" type="text/css" href="dhtmlx/dhtmlxTabBar/codebase/dhtmlxtabbar.css">
        <link rel="stylesheet" type="text/css" href="dhtmlx/dhtmlxLayout/codebase/dhtmlxlayout.css">
        <link rel="stylesheet" type="text/css" href="dhtmlx/dhtmlxLayout/codebase/skins/dhtmlxlayout_dhx_skyblue.css">
        <link rel="stylesheet" type="text/css" href="dhtmlx/dhtmlxTree/codebase/dhtmlxtree.css">
        <link rel="stylesheet" type="text/css" href="dhtmlx/dhtmlxChart/codebase/dhtmlxchart.css">

        <!-- Common Includes -->
        <script src="dhtmlx/dhtmlxcommon.js">                                         </script>
        <script src="dhtmlx/dhtmlxConnector/codebase/connector.js">         </script>
        <script src="dhtmlx/dhtmlxDataProcessor/codebase/dhtmlxdataprocessor.js">     </script>
        <script src="dhtmlx/dhtmlxDataProcessor/codebase/dhtmlxdataprocessor_debug.js">     </script>

        <!-- dhtmlxGrid specific includes -->
        <script src="dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid.js">                       </script>
        <script src="dhtmlx/dhtmlxGrid/codebase/dhtmlxgridcell.js">                   </script>
        <script src="dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid_hmenu.js">                 </script>
        <script src="dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_filter.js">            </script>
        <script src="dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_nxml.js">              </script>

        <!-- dhtmlxTabBar specific includes -->
        <script src="dhtmlx/dhtmlxTabBar/codebase/dhtmlxtabbar.js">                   </script>
        <script src="dhtmlx/dhtmlxTabBar/codebase/dhtmlxcontainer.js">                </script>

        <!-- dhtmlxTree specific includes -->
        <script src="dhtmlx/dhtmlxTree/codebase/dhtmlxtree.js">                       </script>

        <!-- dhtmlxLayout specific includes -->
        <script src="dhtmlx/dhtmlxLayout/codebase/dhtmlxcontainer.js">                </script>
        <script src="dhtmlx/dhtmlxLayout/codebase/dhtmlxlayout.js">                   </script>

        <!-- jQuery Library -->
        <script src="code/jquery.js">                                                 </script> 
    </head>

...

var CmdlineGrid = tabbar.cells("Cmdline_Tab").attachGrid();
$Cmdline_Grid_Headers              = "AIP,Custom Commandline,Owner,Team";
$Cmdline_Grid_Column_Widths        = "20,60,10,10";
$Cmdline_Grid_Column_Resize_Policy = "false,false,false,false";
$Cmdline_Grid_Column_Align         = "left,left,center,center";
$Cmdline_Grid_Column_Sorting       = "str,str,str,str";
$Cmdline_Grid_Column_Type          = "ro,ed,ro,ro";
$Cmdline_Grid_Tooltip_Enable       = "false,false,false,false";
$Cmdline_Grid_Header_Filters       = "#text_filter,#text_filter,#text_filter,#select_filter";
$Cmdline_Grid_Style                = "background-color:#0A62AA;color:white;font-size:11pt;font-weight:bold;\",\"\",\"color:red;\",\"";
$Cmdline_Grid_Skin                 = "modern";
$Cmdline_Grid_Image_Path           = "dhtmlx/dhtmlxGrid/codebase/imgs/";

var DataProcessor = new dataProcessor("data/CmdlineDataPut.php");
//DataProcessor.setTransactionMode("GET");
DataProcessor.init(CmdlineGrid);
//DataProcessor.setDataColumns([false,true,false,false]);

CmdlineGrid.setHeader          ($Cmdline_Grid_Headers);
CmdlineGrid.setInitWidthsP     ($Cmdline_Grid_Column_Widths);
CmdlineGrid.enableResizing     ($Cmdline_Grid_Column_Resize_Policy);
CmdlineGrid.setColAlign        ($Cmdline_Grid_Column_Align);
CmdlineGrid.setColSorting      ($Cmdline_Grid_Column_Sorting);
CmdlineGrid.setColTypes        ($Cmdline_Grid_Column_Type);
CmdlineGrid.enableTooltips     ($Cmdline_Grid_Tooltip_Enable);
CmdlineGrid.attachHeader       ($Cmdline_Grid_Header_Filters);
CmdlineGrid.enableEditEvents   (false,true,true);
CmdlineGrid.enableMultiselect  (true);
CmdlineGrid.setStyle           ($Cmdline_Grid_Style);
CmdlineGrid.setSkin            ($Cmdline_Grid_Skin);
CmdlineGrid.setImagePath       ($Cmdline_Grid_Image_Path);
CmdlineGrid.init();
CmdlineGrid.load               ("data/CmdlineDataGet.php");

The only line that is different in this situation is the log file name. I was originally trying to use the same file for sending and receiving because the documentation says that works. However, as a debug method, I separated the files. When the page loads, the “get_sql.log” file updates with a “SELECT…” query as it should. When I change one of the cells in the grid and hit enter, the “put_sql.log” file updates as it should, but it has a “SELECT…” query instead of “UPDATE…” which isn’t right. Also, the parameters in the dataprocessor debug window are NULL and the server response is exactly what you would expect a “SELECT…” statement to say, e.g. the same data that was loaded during the page refresh. The dataprocessor_debug window correctly shows which cell was changed, the ID of the row, and that it is trying to send data. However, like I said before, it is simply doing a “SELECT…” and never an “INSERT…” or “UPDATE…” to the db.

I am sending and receiving data from the db using files that look exactly like these:

(Note: You can see how these files are used in the init code. The Put file is passed to the dataprocessor init and the Get file is passed to the grid init.)

[code]
//CmdlineDataPut.php

<?php //Load the grid_connector from the dhtmlxConnector component require_once("../dhtmlx/dhtmlxConnector/codebase/grid_connector.php"); //Connect to the sql server and select the db $res = mysql_connect("","",""); mysql_select_db(""); //Create a new GridConnector object and create xml output from the db table $gridConn = new GridConnector($res,"MySQL"); $gridConn->enable_log("put_sql.log",true); $gridConn->render_table("","",",,,"); ?>[/code]

[code]
//CmdlineDataGet.php

<?php //Load the grid_connector from the dhtmlxConnector component require_once("../dhtmlx/dhtmlxConnector/codebase/grid_connector.php"); //Connect to the sql server and select the db $res = mysql_connect("","",""); mysql_select_db(""); //Create a new GridConnector object and create xml output from the db table $gridConn = new GridConnector($res,"MySQL"); $gridConn->enable_log("get_sql.log",true); $gridConn->render_table("
","",",,,"); ?>[/code]

Here is an image of the output of the debugger after typing “asdf” in the 2nd column, 2nd row and hitting enter. As you can see in the highlighted area of the debugger, the string “aaaaaaaa” is properly returned as it is stored in the database, but “asdf” is not returned because it was never sent.

I have no idea what’s wrong. Am I supposed to use a different API call to send data? I tried putting javascript alert statements in many of the API calls that deal with sending data and never got one to appear.


Annoying forum software…hit enter too soon and it won’t let me edit my post.

I meant to put that picture inline above the last paragraph.

Try to change order of includes

    <script src="dhtmlx/dhtmlxDataProcessor/codebase/dhtmlxdataprocessor.js">     </script>
    <script src="dhtmlx/dhtmlxConnector/codebase/connector.js">         </script>

connector need to go after dataprocessor.

Thanks. That got me one step further. Here is what I see now (the bold text is new):

I’m wondering if something is wrong with my configuration as my grid doesn’t seem to have any Column IDs. When I type the following command I get an empty alert: alert(CmdlineGrid.getColumnId(1));

However, if I try to set the Ids, the page won’t load: CmdlineGrid.setColumnIds("AIP,Cmdline,Owner,Team");

As another data point, I was trying to figure out if my CmdlineDataPut.php file was even being accessed, so I put system(“ls > file.log”); at the top. Initially, it was not putting a file called “file.log” in my data directory, but after commenting out all of the code using $_GET[’…’] statements it did put “file.log” in the right place. That tells me the php file is at least being accessed at the right time - “file.log” is created after I enter something in my grid and then hit enter to submit the change. That’s all good news because it means I’m close I think. The real problem is that my parameters are still null.

Here is all of the relevant setup information:

CSS and Library includes:

[code]

VIP Central

<!-- Include styles for dhtmlx objects and custom styles for the header bar -->
<link rel="stylesheet" type="text/css" href="code/VIP_Central.css">
<link rel="stylesheet" type="text/css" href="dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid.css">
<link rel="stylesheet" type="text/css" href="dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid_skins.css">
<link rel="stylesheet" type="text/css" href="dhtmlx/dhtmlxTabBar/codebase/dhtmlxtabbar.css">
<link rel="stylesheet" type="text/css" href="dhtmlx/dhtmlxLayout/codebase/dhtmlxlayout.css">
<link rel="stylesheet" type="text/css" href="dhtmlx/dhtmlxLayout/codebase/skins/dhtmlxlayout_dhx_skyblue.css">
<link rel="stylesheet" type="text/css" href="dhtmlx/dhtmlxTree/codebase/dhtmlxtree.css">
<link rel="stylesheet" type="text/css" href="dhtmlx/dhtmlxChart/codebase/dhtmlxchart.css">

<!-- Common Includes -->
<script src="dhtmlx/dhtmlxcommon.js">                                          </script>

<!-- dhtmlxGrid specific includes -->
<script src="dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid.js">                        </script>
<script src="dhtmlx/dhtmlxGrid/codebase/dhtmlxgridcell.js">                    </script>
<script src="dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_filter.js">             </script>
<script src="dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_nxml.js">               </script>
<script src="dhtmlx/dhtmlxDataProcessor/codebase/dhtmlxdataprocessor.js">      </script>
<script src="dhtmlx/dhtmlxDataProcessor/codebase/dhtmlxdataprocessor_debug.js"></script>
<script src="dhtmlx/dhtmlxConnector/codebase/connector.js">                    </script>

<!-- dhtmlxTree specific includes -->
<script src="dhtmlx/dhtmlxTree/codebase/dhtmlxtree.js">                        </script>

<!-- dhtmlxLayout specific includes -->
<script src="dhtmlx/dhtmlxLayout/codebase/dhtmlxcontainer.js">                 </script>
<script src="dhtmlx/dhtmlxLayout/codebase/dhtmlxlayout.js">                    </script>

<!-- dhtmlxTabBar specific includes -->
<script src="dhtmlx/dhtmlxTabBar/codebase/dhtmlxtabbar.js">                    </script>
<script src="dhtmlx/dhtmlxTabBar/codebase/dhtmlxcontainer.js">                 </script>

<!-- jQuery Library -->
<script src="code/jquery.js">                                                  </script> 
[/code]

Grid and DataProcessor definitions (the code is shown in the order it is executed)

$Cmdline_Grid_Headers                = "AIP,Custom Commandline,Owner,Team";
$Cmdline_Grid_Column_Widths          = "20,60,10,10";
$Cmdline_Grid_Column_Resize_Policy   = "false,false,false,false";
$Cmdline_Grid_Column_Align           = "left,left,center,center";
$Cmdline_Grid_Column_Sorting         = "str,str,str,str";
$Cmdline_Grid_Column_Type            = "ro,ed,ro,ro";
$Cmdline_Grid_Tooltip_Enable         = "false,false,false,false";
$Cmdline_Grid_Header_Filters         = "#text_filter,#text_filter,#text_filter,#select_filter";
$Cmdline_Grid_Style                  = "background-color:#0A62AA;color:white;font-size:11pt;font-weight:bold;\",\"\",\"color:red;\",\"";
$Cmdline_Grid_Skin                   = "modern";
$Cmdline_Grid_Image_Path             = "dhtmlx/dhtmlxGrid/codebase/imgs/";
//$Cmdline_Grid_Column_IDs             = "AIP,Cmdline,Owner,Team";

//////////////////////////////////////////////
///// Define and instantiate CmdlineGrid /////
//////////////////////////////////////////////
CmdlineGrid.setHeader          ($Cmdline_Grid_Headers);
CmdlineGrid.setInitWidthsP     ($Cmdline_Grid_Column_Widths);
CmdlineGrid.enableResizing     ($Cmdline_Grid_Column_Resize_Policy);
CmdlineGrid.setColAlign        ($Cmdline_Grid_Column_Align);
CmdlineGrid.setColSorting      ($Cmdline_Grid_Column_Sorting);
CmdlineGrid.setColTypes        ($Cmdline_Grid_Column_Type);
CmdlineGrid.enableTooltips     ($Cmdline_Grid_Tooltip_Enable);
CmdlineGrid.attachHeader       ($Cmdline_Grid_Header_Filters);
CmdlineGrid.enableEditEvents   (false,true,true);
CmdlineGrid.enableMultiselect  (true);
CmdlineGrid.setStyle           ($Cmdline_Grid_Style);
CmdlineGrid.setSkin            ($Cmdline_Grid_Skin);
CmdlineGrid.setImagePath       ($Cmdline_Grid_Image_Path);
CmdlineGrid.init();
//CmdlineGird.setColumnIds       ($Cmdline_Grid_Column_IDs); //doesn't work, page won't load

var DataProcessor = new dataProcessor("data/CmdlineDataPut.php");
DataProcessor.init(CmdlineGrid);
DataProcessor.setTransactionMode("POST",true);
DataProcessor.setDataColumns("false,true,false,false");

//many other grids configured in this area

CmdlineGrid.load  ("data/CmdlineDataGet.php");

Here is my CmdlineDataGet.php file:

[code]

<?php require_once("../dhtmlx/dhtmlxConnector/codebase/grid_connector.php"); //Connect to the sql server and select the db $res = mysql_connect("","",""); mysql_select_db(""); //Create a new GridConnector object and create xml output from the db table $gridConn = new GridConnector($res,"MySQL"); $gridConn->render_table("aipinfo","AIP","AIP,Cmdline,Owner,Team"); ?>[/code]

Here is my CmdlineDataPut.php file (This was totally wrong in my first post, but I found a sample that made it much more clear. My first attempt was not performing any INSERT/UPDATE/DELETE operations. I have confirmed that my database responds to the commands in this file, but since the variables aren’t being passed in, it doesn’t work when I try to use it with the real page):

[code]

<?php system("ls > file.log"); $link = mysql_connect("", "", ""); $db = mysql_select_db(""); function add_row(){ global $newId; $sql = "INSERT INTO aipinfo(Cmdline) VALUES ('"addslashes($_GET["c1"])"')"; $res = mysql_query($sql); $newId = mysql_insert_id(); return "insert"; } function update_row(){ $sql = "UPDATE aipinfo SET Cmdline='" . addslashes($_GET["c1"]) . " WHERE AIP=" . $_GET["gr_id"]; $res = mysql_query($sql); return "update"; } function delete_row(){ $d_sql = "DELETE FROM aipinfo WHERE AIP=" . $_GET["gr_id"]; $resDel = mysql_query($d_sql); return "delete"; } header("Content-type: text/xml"); echo('<?xml version="1.0" encoding="iso-8859-1"?>');

$mode = $_GET["!nativeeditor_status"]; //get request mode
$rowId = $_GET[“gr_id”]; //id or row which was updated
$newId = $_GET[“gr_id”]; //will be used for insert operation

switch($mode){
case “inserted”:
$action = add_row();
break;
case “deleted”:
$action = delete_row();
break;
default:
$action = update_row();
break;
}
echo “”;
echo “”;
echo “”;

mysql_close($link);

?>[/code]

What defines the Column IDs in my setup? Does the render_table function in CmdlineDataGet.php do it, or am I supposed to do it in my grid configuration? I don’t even know if that is the problem, but it seems like it could be.

I could upload my entire project if that would help. You obviously wouldn’t be able to access my database, but I could include statis XML files to load the data instead. If it would help please let me know. Any help is greatly appreciated.

a) column ids are not necessary for data saving, server side known the order of data columns, so it maps data to necessary fields based on column indexes

parameters null

Which version of dhtmlx component are you using? Is any chance that you are using dhtmlxgrid.js and dhtmlxdataprocessor.js from different versions?