How to refresh newly added event?

I have a problem trying to refresh a just added new event. I’m using a java connector which inserts a new row into a database, then the server-side logic is generating some additional data. I want to have the generated data sent back to Scheduler.
Now I have a solution like this:

		scheduler.attachEvent("onEventAdded",function(id,event){
			window.setTimeout('reload();', 500);
			return true;
  		});		

	function reload() {
		scheduler.clearAll();
		scheduler.load("sch.do?sesja=blablabla");
	}

But there is a problem: onEventAdded is called immediately after the event is added and reload is executed before the insert is complete. Then the event “disappears” from Scheduler and user must click a “Reload” button to see it again.
How to do it properly to be sure that reload is called after insert is complete?

Hello,

You mean how to call this function after event was inserted to the database?
Is so be sure to check events of dataprocessor.
What you need is onAfterUpdate event.

Best regards,
Ilya