Updating description after event update when using template

Hello,

I’ve overridden the event text with code like this:

scheduler.templates.event_text=function(start,end,event){ return "<b>" + event.customer_name +"</b><br>"+"("+event.service_description + ")"; }

My issue is that if I don’t trigger a reload of the events from the server after an event is updated (onAfterLightbox), the event text will show as undefined. So, I added:

scheduler.attachEvent("onAfterLightbox",function(event_id, event_object){ scheduler.clearAll(); scheduler.load("/events/records?ts=" + (new Date()).valueOf()); return true; });

The issue I’m now having is that depending on how quickly the onAfterLightbox fires and how quickly the load event occurs, the new event may not have been committed to the database yet, so it doesn’t appear. (It’s VERY intermittent - that database update only takes a few milliseconds, but it happens often enough that I’d worry about a user thinking the record hadn’t saved.)

I really don’t want to kludge this by introducing some kind of sleep/wait type loop to give the database enough time to refresh. Is there a better way where I can either dynamically update the new event with the correct text (so I don’t have to query the database at all after an event is added/updated) or make the onAfterLightbox behavior synchronous somehow with adding the record (so I can be guaranteed the record is saved before onAfterLightbox fire)?

Thanks,
Chris

You can try to use

dp.attachEvent("onFullSync",function(){ scheduler.clearAll(); scheduler.load("/events/records?ts=" + (new Date()).valueOf()); return true; });

onFullSync event of dataprocessor will occur, when data is saved in DB.

where I can either dynamically update the new event with the correct text (
It possible as well, you can send extra info as part of update response and some more after update logic on client, which will take data from response, and will update the event in question

Are you using connectors on server side, or custom solution?

I’m having the same problem: scheduler.template.event_text() doesn’t get apply after event is changed. I tried:

scheduler.attachEvent("onEventChanged", function(event_id, event_object){ scheduler.updateEvent(event_id); return true; });

…thinking re-rendering the event would call the template but it doesn’t seem to do anything! Any solution for this?

Kind regards

Hello,

I can’t confirm this issue, can you please add more details?
Check the following small sample where I update single event and template is applied correctly:

[code]

html, body{ margin:0px; padding:0px; height:100%; overflow:hidden; }
 
 
[/code] Best regards, Ilya