Hi! I've updated Scheduler from 4.1.5 to 4.3.8 and discovered that when event creation is triggered (by double-click or from the context menu or by event drag create feature) - a placeholder event is created. Previously, returning <false> in beforeEventEdit listener was preventing this behavior.
Screenshot 2022-02-10 080623.png (14.45 KiB) Viewed 626 times
Please suggest how to get rid of creating empty placeholder events.
Thank you for the response.
Thing is that I don't want to turn off the event listeners. The aim is to still be able to create events, but with custom handling - without creating placeholder events on the clicked area as it was before the update.
Hi,
I just found a way to achieve that.
So to achieve that you don't need to use the beforeEventAdd event. It is doable with beforeEventEdit.
So in the beforeEventEdit Handler function
beforeEventEditHandler(event) {
// check if it's creating an event or not
if(event.eventElement.classList.contains('b-iscreating')) {
// make the placeholder event invisible
document.querySelector('.b-iscreating[data-task-feature="event"]').style.display = 'none';
}
// Open the editor
this.openEditor(event);
return false;
}
Second thing is to display the event when it is saved.
So you need to add some code in the Save event listener.
Add this code in the save event listener before you do something like this.$emit('close').
// check if it is available
if (document.querySelector('.b-sch-event[style="display: none;"]')) {
// make it visible on the ui
document.querySelector('.b-sch-event[style="display: none;"]').style.display = null;
}
This should solve your issue.
Please let us know if it solves the issue for you.
thanks a lot for your response.
This solution seems to work, but just for the first time. The second time I create a new event the placeholder Object.NewEvent is still generated.
Just a precisation: I'm using Angular 13 and Angular wrapper, I followed this thread just because my problem was the same.
I don't know if it makes any difference.