I am making a ajax call onEventSave event and in the service call I am just running a stored procedure that saves the event attributes in the database. Now i am saving the event_id as it which I get from the scheduler for e.g. 1295037291464. I have read on the forum that this id is only temporary and needs to be converted to a actual unique id before saving, so how am I supposed to get that id?
you can also suggest if there is a better way of doing things.
The id is not trully unique ( it is based on timestamp of event creation ), so if you have multi-user environment , there is a chance that two event will be created in the same time and as result will have the same id ( chance is pretty small, but still here )
Normally , when you saving data in DB you get some unique DB id for that record, and after receiving callback , can call something like
scheduler.changeEventId(old_id, new_id);
you can also suggest if there is a better way of doing things.
Your approach has not any big problems.
Normally, it is expected to use
- onEventCreated
- onEventChanged
- onBeforeEventDelete
for event saving ( they will occur for all kind of edit|add|delete operations , while onEventSave occurs only for lightbox form closing )
Can the new id that is returned from db callback be GUID or does it have to be a int.
It can be any unique string value, GUID will be fine