I recently updated to the newest versions of dhtmlxcommon and installed the IE9 hotfix, but now my dataconnector isn’t working properly.
Here is my client side code (I pass along an account name to the gridconnector):
dp = new dataProcessor(“data/gridconnector.php?accountName=account1”);
dp.init(mygrid);
mygrid.init();
mygrid.load(“data/gridconnector.php?accountName=account1”);
Here is gridconnector.php:
require(“…/dataconnector/codebase/grid_connector.php”);
require_once(“…/includes/db.php”);
$res=mysql_connect($host,$user,$password);
mysql_select_db($dbName);
$query = “SELECT id FROM accounts WHERE accountName=‘$_GET[accountName]’”;
$result = mysql_db_query($dbName, $query, $link);
$row = mysql_fetch_array($result);
$accountID = $row[‘id’];
$gridConn = new GridConnector($res,“MySQL”);
function my_update($data){
global $gridConn;
$firstName=$data->get_value(“firstName”);
$lastName=$data->get_value(“lastName”);
$number=$data->get_value(“number”);
$carrierID=$data->get_value(“carrierID”);
LogMaster::log("Trying to update");
$id=$data->get_value("id");
$gridConn->sql->query("UPDATE numbers SET firstName='{$firstName}', lastName='{$lastName}', number='{$number}', carrierID='{$carrierID}' where id={$id}");
$data->success(); //if you have made custom update - mark operation as finished
}
$gridConn->event->attach(“beforeUpdate”,“my_update”);
$gridConn->render_sql(“SELECT numbers.id, firstName,lastName,number,carrierID,‘0’ as send FROM numbers, carriers WHERE carriers.id=numbers.carrierID AND accountID=‘$accountID’”,“id”,“id,firstName,lastName,number,carrierID,send”);
When I run this, loading works perfectly fine. When I go to update, an alert box pops up with this:
"<?xml version='1.0' encoding='utf-8' ?>
"
Containing all the data in the table. The log just reads:
SELECT numbers.id, firstName,lastName,number,carrierID,‘0’ as send FROM numbers, carriers WHERE carriers.id=numbers.carrierID AND accountID=‘1’
Done in 0.00346708297729s
It doesn’t seem to be triggering the “beforeUpdate” event. Any ideas?