But if someone creates another event at the same time with opened popup, then it’s not possible to save this event. You need to close popup (losing entered data) and then click on calendar again to create a new event.
You can either add additional logic (say if Lightbox is displayed do not clear all events yet) or try implementing live updates as described in documentation: docs.dhtmlx.com/doku.php?id=dhtm … ive_update
Can you please take a look at this solution. I just send reload every second, but update only if the popup is closed and if it’s at least 5 minutes since last update.
var lastUpdate = new Date();
function updateCalendar() {
var diff = new Date() - lastUpdate;
if($('.dhx_cal_light:visible').length <= 0 && diff > 5 * 60 * 1000) {
scheduler.clearAll();
scheduler.load("myurl", "json");
lastUpdate = new Date();
}
}
setInterval(updateCalendar, 1000);
Is it a correct way to detect, if a popup is opened?