I have a "change" trigger setup against the eventStore / assignmentStore which triggers data to get sent to the backend to get saved. The problem I'm having is that when initializing the screen with all the initial schedule events, this trigger is being set off, causing there to be unnecessary updates to the backend database. Actually, it does it twice since I have it setup to save changes any time the assignments -or- the events change.
The frontend is adding the events like below to the Scheduler Pro instance:
this.schedulerPro.eventStore.add(this.schedulerEvents(i),
true
); // I don't know how to quote square brackets in the forums, so I changed all the square brackets to paranthesis
In the API documentation, I see to send "true"
as the second argument to silence triggers,
but the trigger is still being set off.Using the web dev tools,
I stepped through this method,
and notice it 's going into "RecurringTimeSpansMixin" (I am using Recurring Times in the calendar).. But I noticed that the add function here doesn'
t have a second argument defined:
[code]
add(record) {
...
return super.add(records);
}
[/code]
Stepping into the "super.add"
call, which goes to the "add"
method in StoreStm.js,
I see that that one does have the second argument defined:
[code]
add(records, silent = false) {[/code]
Is there any way I could get around this? I tried setting a property before and after the "add" calls up on top to suppressEvents just before the add, and then resumeEvents afterward, but that doesn't seem to work since the triggers seem to be executed afterward asynchronously.