Sync and Save

Hi All,

I have the Sync and the collision activated, however when I create a new event simultaneously in different users it allows me to have 2 event at the same time.

Is there any way to prevent this?
It is possible to check collision before saving in the database?

Regards,
Walter

It possible to add validation rules to the server side code

docs.dhtmlx.com/doku.php?id=dhtm … validation

you can attach code to the beforeProcessing action and from it run sql code against DB to check is this time slot free.

I try to use this logic but I have some problems. This is the code I add:

dp.defineAction("invalid",function(response){
     var id= response.getAttribute("id");
     deleteEvent(id);
     return false;// return false to cancel default data processing at all
})

function validate($data){
     $data->invalid();
}
$scheduler->event->attach('beforeInsert','validate');

What I am trying to do if that every time I create a new event it is canceled from db Update and deleted from the screen. The db part is working, but I can’t delete the event in the screen.
The problem is first that I can’t get the id with this: response.getAttribute(“id”). Also the deleteEvent() won’t work if I have this value. Is there any easy way to to this?

Regards,
Walter

As for id value, you need to use

var id= response.getAttribute(“sid”);

as default response has sid, ted, action attributes and doesn’t have id attribute

As for deleting - normally delete call from custom action must work correctly. I will try to reconstruct the issue locally and contact when some results will be available.

It Works! Thanks for the help.

This is the final code:

dp.defineAction("invalid",function(response){
	var id = response.getAttribute("sid");
	scheduler.deleteEvent(id);
	return false;// return false to cancel default data processing at all
})