I have a datastore and dataprocessor linked to a mysql database initiated by:
var myds = new dhtmlXDataStore({
url: “mydata.php”,
datatype: “xml” });
var mydp = new dataProcessor(“mydata.php”);
mydp.init(myds);
Then I have a grid sync-ed to the datastore
var mygrid…
…
mygrid.sync(myds);
And a form bound to the grid
var myform…
…
myform.bind(mygrid);
All is working fine for manual changes to data for existing records made to either the grid or the form. But when I try to add a new record I have a problem.
The problem is that the id field i’m using for the grid is an autoincrement field supposedly set by mysql on the sql insert. The record is created in the mysql table with correct defaults, the new row appears on the grid and I’m able to auto-select it to appear on the bound form but that autoincrement field value is not making its way back into the id for that grid row.
To add the record I’m using
myds.add({Field1:“default1”,Field2:“default2”,…});
I have a dataprocessor OnAfterUpdate event
mydp.attachEvent(“onAfterUpdate”, function(id, action, tid, response) {…}
and that is returning
id= a very large number (presumably set by dhtmlx)
action = inserted
tid = the value of the autoincrement field
How does the value of tid get put back into the id of th new row of the grid?
I’ve tried setting the row’s id to tid.
no matter what I do I “Invalid mixing target” errors in the javascript debugger.