Refresh the calendar

Hi,



In dhtmlxscheduler, how to refresh the calendar so that all new events added by different users will become visible to all users?

How to refresh the calendar in every seconds?



regards

rencin.

You can repeat load command with some interval, the component is clever enough to not duplicate already existing events and only will add new ones.

window.setInterval(function(){
scheduler.load(some_url);
},3000);

This method give many problem. For example, if i’m in the lightbox to insert an event during the launch of scheduler.load, the scheduler crashes. How I can add an if selection, that in case i’m inserting an event stops the timeout interval?

Hello,

window.setInterval(function(){ if(!scheduler.getState().lightbox_id) // is lightbox is not open then load events scheduler.load(some_url); },3000);

Best regards,
Ilya

Thanks, anyway for these days i’m using this:

scheduler.attachEvent(“onEventCreated”, function(event_id,event_object){
window.clearInterval(x);
});
so, during the event creations i stop the timer, and

scheduler.attachEvent(“onAfterLightbox”, function (){
x = window.setInterval(function(){
scheduler.clearAll();
scheduler.load(“types.php?uid=”+scheduler.uid());},3000);
});
that let the timer start one more time after an event creation…
But your code looks pretty then mine…
Thank!