Reload / update event data without ClearAll()

Hi,

I want to reload Event data from database.
I went through some posts, Everywhere i found this

`scheduler.clearAll();
scheduler.load(url);`

Which basically i don’t need to CLEAR my events for loading them again.
I need something which work without having them CLEARED and update them silently with database table.

Lets say, if in my database there are 10 events and they are loaded on SCHEDULER.
Later on, if my database table gets updated from not through ( SCHEDULER ) functions.
But from any third party function and it adds 1 new row.

So by calling scheduler.load() … or something else if it is available… i could get able to silently update events on calling without CLEARING THEM ALL first.

Regards

Hi,

well, clearing old events is the simplest way to fetch new data.

I’m guessing you’re looking for some another way because the reloading is very noticeable - scheduler goes blank for a moment and then data appears again.
If that’s the issue you want to prevent, you can do it by calling clearAll right before parsing new data, rather than before ajax loading.
In order to do so, you’ll need to load events from the backend manually via ajax request and clear the old data once everything is loaded:

$.ajax({
  url: "/data/events"
})
  .done(function( data ) {
    // data - string or object of the supported structure
    // https://docs.dhtmlx.com/scheduler/data_formats.html
    scheduler.clearAll();
    scheduler.parse(data);
  });

That way the data will be replaced synchronously and the calendar won’t blink when you replace the data.

Technically, you could just call scheduler.load without clearing the old data. Scheduler overwrites old records with the new ones, which means that any changes made in the database will be applied. But it won’t remove the events that were deleted in the database, they will just stay loaded in scheduler, that’s why scheduelr.clearAll is advised.

Does it solve your issue, or were you looking for something different?