onBeforeDataSending event returning null arguments

I am trying to do some validation using onBeforeDataSending however when the event fires, the arguments that are returned are all null. For example in the following snippet taken from an otherwise fully functional grid and dataprocessor, id is null.

var myDP = new dataProcessor(connGet);
myDP.init(mygrid);
myDP.setUpdateMode("off");
myDP.attachEvent("onFullSync",onGridSync);
myDP.attachEvent("onBeforeDataSending",function(id,state,data){
		document.getElementById("outputArea").innerHTML = "Debug: "+id;
		return true;
});

I am using dhtmlxSuite_v403_std and connector-php-master v2.0.

(For info, I also have the same problem as in viewtopic.php?f=19&t=36863&start=0 where I must include connector.js to make filters work.)

Thanks for your help.

There are two types of data sending mode

  • one-by-one - update for each row sent as separate reques
  • all-at-once - multiple updates sent as a single request

If you are using connector - all-at-once is the default mode. In such case onBeforeDataSending will not provide any valid id, as data sending occurs for multiple rows.

Try to use onBeforeUpdate - it will be called for each row, before sending data to the server side, and will work for both data sending modes.