I have a grid with a dataprocessor. I add a row to the grid, and verified the row gets written to the database. With focus remaining on the newly-added row, I then attempt to delete the row. It disappears from the grid, but not from the database. Refreshing the page causes the grid row I’d just deleted to reappear. It can then be successfully deleted from the grid and database after the refresh.
Here is the client code:
<link rel='stylesheet' type='text/css' href='./dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid.css'>
<link rel='stylesheet' type='text/css' href='./dhtmlx/dhtmlxGrid/codebase/skins/dhtmlxgrid_dhx_skyblue.css'>
<link rel='stylesheet' type="text/css" href='./dhtmlx/dhtmlxGrid/samples/common/css/style.css' media="screen" />
<script src='./dhtmlx/dhtmlxGrid/codebase/dhtmlxcommon.js'></script>
<script src='./dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid.js'></script>
<script src='./dhtmlx/dhtmlxGrid/codebase/dhtmlxgridcell.js'></script>
<script src='./dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_validation.js' type='text/javascript' charset='utf-8'></script>
<script src='./dhtmlx/dhtmlxGrid/samples/common/data.js'></script>
<script src='./dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_srnd.js'></script>
<script src='./dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_filter.js'></script>
<script src='./dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_form.js'></script>
<!-- Dataprocessor -->
<script src='./dhtmlx/dhtmlxDataProcessor/codebase/dhtmlxdataprocessor.js'></script>
<script src='./dhtmlx/dhtmlxDataProcessor/codebase/dhtmlxdataprocessor_debug.js'></script>
...
myGrid2.setImagePath("./dhtmlx/dhtmlxGrid/codebase/imgs/");
myGrid2.setHeader("Source,Type,Referrals,Contact Date,Follow Up,Cost,ContactID, ReferralID");
myGrid2.attachHeader("#select_filter,#select_filter,#text_filter,#text_filter,#text_filter,#text_filter,,");
myGrid2.setInitWidths("100,100,150,85,85,85,0,0");
myGrid2.enableAutoWidth(true);
myGrid2.setColAlign("left,left,left,right,right,right,left,left");
// See http://docs.dhtmlx.com/doku.php?id=dhtmlxgrid:initialization_from_xml
// http://docs.dhtmlx.com/doku.php?id=dhtmlxgrid:cells_manipulation#getting_select_box_collection
// http://docs.dhtmlx.com/doku.php?id=dhtmlxconnector:filtration
// for more info on populating select box collection.
myGrid2.setColTypes("co,co,ed,ed,ed,price,ed,ed");
myGrid2.setColumnIds("0,1,2,3,4,5,6,7");
myGrid2.enableValidation(true, true);
myGrid2.setColValidators(["NotEmpty","NotEmpty","NotEmpty",,,,"NotEmpty","NotEmpty"]);
myGrid2.setColSorting("str,str,str,date,date,int,str,str");
myGrid2.enableMultiselect(true);
myGrid2.setSkin("dhx_skyblue");
myGrid2.init();
myGrid2.enableSmartRendering(true);
// Initiate referrals data processor. For more on dataprocessor, see http://docs.dhtmlx.com/doku.php?id=dhtmlxgrid:dataprocessor.
myDataProcessor = new dataProcessor("FrstConnectorReferrals.php"); // use the connector file as a constructor parameter.
myDataProcessor.init(myGrid2);
myDataProcessor.setUpdateMode("cell",true);
myDataProcessor.setDataColumns("true,true,true,true,true,true,true,true");
Here is the dp code:
$pwd=file_get_contents("C:\inetpub\wwwroot_DEV\pwd.txt");
$connectionInfo = array( "UID"=>$uid, "PWD"=>$pwd, "Database"=>"COF_Objects_Dev", "LoginTimeout"=>15); // <- SS authentication
$res = sqlsrv_connect( $serverName, $connectionInfo); // <- SS authentication
if($res)
{
//echo "Connection established.\n";
$qs = $_GET['clientid'];
$grid = new GridConnector($res,"sqlsrv");
$grid->dynamic_loading(100);
// See http://docs.dhtmlx.com/doku.php?id=dhtmlxconnector:loading_editing_data for allowable SQL statement syntax.
// and http://docs.dhtmlx.com/doku.php?id=dhtmlxconnector:jsondataconnector.
if($grid->is_select_mode())
{
$thesql = "SELECT REPLACE(Source, CHAR(39), CHAR(96)) AS Source, REPLACE(Type, CHAR(39), CHAR(96)) AS Type, Referrals, (CASE WHEN CONVERT(varchar, ContactDate, 101) = '01/01/1900' THEN '' ELSE CONVERT(varchar, ContactDate, 101) END) AS ContactDate, (CASE WHEN CONVERT(varchar, FollowupDate, 101) = '01/01/1900' THEN '' ELSE CONVERT(varchar, FollowupDate, 101) END) AS FollowupDate, CONVERT(varchar,Cost,1) AS Cost, ContactID, ReferralID FROM COF_FrstReferrals_tbl WHERE ContactID='".$qs."'";
$grid->render_sql($thesql, "ReferralID", "Source, Type, Referrals, ContactDate, FollowupDate, Cost, ContactID, ReferralID");
}
else
{
$grid->render_table("COF_FrstReferrals_tbl", "ReferralID", "Source, Type, Referrals, ContactDate, FollowupDate, Cost, ContactID, ReferralID");
}
if($grid)
{
//echo "rendering table ...\n";
}
else
{
//echo "grid not loaded!\n";
}
}
else
{
//echo "Connection could not be established.\n";
die( print_r( sqlsrv_errors(), true));
}
Here is the dataprocessor log:
Current mode: cell
Log:
row 1360353874706 marked [inserted,valid]
Initiating data sending for 1360353874706
Initiating data sending for all rows
Sending all data at once
Server url: FrstConnectorReferrals.php?editing=true parameters
Server response received details
<?xml version='1.0' ?><data><action type='inserted' sid='1360353874706' tid='' ></action></data>
Action: inserted SID:1360353874706 TID:
row 1360353874706 unmarked [updated,valid]
row marked [deleted,valid]
Initiating data sending for all rows
Sending all data at once
Server url: FrstConnectorReferrals.php?editing=true parameters
Server response received details
<?xml version='1.0' ?><data><action type='deleted' sid='' tid='' ></action></data>
Action: deleted SID: TID:
row unmarked [updated,valid]
row unmarked [updated,valid]
Hope you can help me. Thanks!