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
[code]
//CmdlineDataGet.php
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.