Our powerful JS Calendar component


Post by codevlabs »

Dear Support,

Using angular, we have the following setup.

<bryntum-calendar style="width:100%"
	...
	(onBeforeEventSave)="beforeEventSave($event)">
</bryntum-calendar>
public async beforeEventSave(eventRecord){	
		const result = await MessageDialog.confirm({
				title   : 'Please confirm (beforeEventSave)',
				message : `Start time: ${DateHelper.format(eventRecord.eventRecord.data.startDate, 'ddd LST')}<br>End time: ${DateHelper.format(eventRecord.eventRecord.data.endDate, 'ddd LST')}`
			});
	
		// Return true to accept the drop or false to reject it
		return result === MessageDialog.okButton;
}

Using the above, I expect that the event save is cancelled. We are also using the crudmanager which is still fired when the user presses CANCEL. We looked at CrudManager events like before sync but not sure whats the best practice in this case.

We want the user to confirm the edit/save of the event. If the user chooses CANCEL, the event is not saved and also the crudmanger is not synced.

Thanks.


Post by Animal »

That will stop the EventEdit from saving. The EventEdit Popup will stay visible, and not save the changes if onBeforeEventSave returns false.


Post by codevlabs »

This is the issue. CRUD Manager is still saving/syncing even when onBeforeEventSave returns false.


Post by ghulam.ghous »

Can we get a small runnable test case (application where we can reproduce this code - it should be minimum code required for the issue) so we can see what is the problem there? Because in ideal case scenario this shouldn't be happening.


Post by Animal »

Is that handler running? You are seeing the confirm dialog?

Because returning false from onBeforeEventSave does stop the event editor from saving the changes to the record as you can see when I inject an implementation into the Calendar:

onBeforeeventSave.gif
onBeforeeventSave.gif (728.74 KiB) Viewed 34 times

Post Reply