Can I use addEvent without the onEventChanged method being fired

I want to add an event programmatically and I want to avoid updating the sever again when this happens. So I’d like to be able to add an event to the calendar without firing any events. Is this possible?

Hello,
Unfortunately, at the moment, when adding an event, some handlers are triggered and this cannot be prevented. But you can manually prevent data sending to the server.

You can add a new property (like addedViaApi: true) to the event object to indicate that the event was created using the API. It might look something like this:

scheduler.addEvent({
    start_date: "2023-01-22 09:00",
    end_date:   "2023-01-22 19:00",
    text:   "Meeting",
    section_id: 4,
    addedViaApi: true
});

And then cancel sending data to the server using the onBeforeUpdate handler:

const dp = scheduler.createDataProcessor({
    url: "/events",
    mode: "REST"
});

dp.attachEvent("onBeforeUpdate", function(id, state, data) {
    if (data.addedViaApi) {
        return false;
    }

    return true;
});

Does this look like what you wanted?

Thanks for the reply. What I wound up doing was

    this.scheduler.clearAll();
    this.scheduler.parse(data);
    this.scheduler.setCurrentView();

which doesn’t fire any events. I’m just clearing and reloading the events while keeping the existing view.

This matches my use case well, since any number of events might be updated and I don’t want to go through the trouble of sorting out what’s changed and what hasn’t.

Thanks!