Hello,
I have a grid control which calls a connector using a querystring. For sake of illustration, I’ve hard-coded the querystring value:
...
myGrid2.init();
myGrid2.enableSmartRendering(true);
myDataProcessor = new dataProcessor("connectorFRST2referralsx.php");
myDataProcessor.init(myGrid2);
myDataProcessor.setUpdateMode("cell",true);
myDataProcessor.setDataColumns("true,true,true,true,true,true");
myGrid2.loadXML("connectorFRST2referralsx.php?contactid=1357236440287")
The PHP connector code is:
...
$qs = $_GET["contactid"];
$grid = new GridConnector($res,"sqlsrv");
$grid->dynamic_loading(100);
$thesql = "SELECT Assistance, Referrals, ContactDate, FollowupDate, ContactID, ReferralID FROM COF_datastoretest2_tbl WHERE ContactID='".$qs."'";
$grid->render_sql($thesql, "ReferralID", "Assistance, Referrals, ContactDate, FollowupDate, ContactID, ReferralID");
When I attempt to delete a row in the grid using this code:
...
var selId = myGrid2.getSelectedId();
if (selId !== null)
{
retType = confirm("Are you sure you want to delete this row?");
if (retType == true)
{
myGrid2.deleteSelectedRows();
}
}
...
… the row disappears from the grid, but not from the database table. Refreshing the webpage causes the row to reappear in the grid.
If I change this code in the PHP connector from this:
$thesql = "SELECT Assistance, Referrals, ContactDate, FollowupDate, ContactID, ReferralID FROM COF_datastoretest2_tbl WHERE ContactID='".$qs."'";
to this:
$thesql = "SELECT Assistance, Referrals, ContactDate, FollowupDate, ContactID, ReferralID FROM COF_datastoretest2_tbl WHERE ContactID='".1357236440287."'";
… the row is deleted from both the grid and the database table.
The dhtmlxdataprocessor_debug log is identical running both variants of the PHP connector code:
Why doesn’t the row get deleted from the table when the querystring value is held in a variable , but gets deleted when it’s hard-coded in the PHP connector, please? Is it possible to use a querystring variable in the PHP connector for performing deletes, and if so, how, please?
Thank you!