Error adding row to grid and then reloading the data

Hi,
I have a strange problem when saving data to a database table and then reloading it.

I’m calling the .addRow method to add the row to the database and then immediately reloading the data from the database to repopulate the grid. I need to do this as there is a reference for the new row that I need that is generated by the database.

It appears from my logging that the reload of the database is occuring before the save and that the connector is getting ‘confused’ - thread safe?

I tried the updateFromXML call but this doesn’t work (see my other post) so I’m performing a
grid.addRow(…my data here…);
grid.clearAll();
grid.loadXML(" my connector etc. here");

I get a javascript error ‘Microsoft JScript runtime error: Unable to set value of the property ‘idd’: object is null or undefined’ in the dhtmlx.js file in the function
this.changeRowId = function (a, b)

If I include an alert(“ok”); between the addRow and clearAll then it works perfectly (but I don’t want a popup in my production code!)

I’m using v.3.0 build 110707 of everything to do with the grid, the dhtmlx.js file from the dhtmlxsuite download (it has no version information but is 906K, modified 13 July 2011), version 0.9.8.3 of dhtmlConnectors.NET from the dhtmlxConnector_net_v10b_110725.zip download.

I have tested with various browsers and there is no difference in what happens so it does not appear to be browser related.

Saving is async, so correct order of commands will be

dp.attachEvent("onFullSync", function(){ grid.clearAll(); grid.loadXML(" my connector etc. here"); }); ... grid.addRow(...);

Works perfectly! Thanks.