In our app we are using the ability to create an event by drawing it on the scheduler.
We added a condition to not create an event if the start_date is before a certain point in time.
This code works as it prevents our create-event modal to show up, however the "drawned but cancelled event" (visually, the rectangle on the scheduler) is still visible. I'd like it to be removed. Is it possible?
I tried with those two events, they correctly prevent our events modal to popup, but it doesn't remove the drawned event.
To be more precise, the issue is in the case where the drag starts in an allowed era, and finishes in a forbidden era. The drag would start from the end_date, dragging right to left, to finish on the start_date.
beforeDragCreate() is good to prevent the drag if it starts from the forbidden era.
How should it work? If you start drag from allowed area, and moved cursor to forbidden area, it should disappear?
It sound logical to not allow start from forbidden area, but in case of drag over forbidden area, remove event only after drop. User can move over forbidden area but in fact drop it correctly.
"User can move over forbidden area but in fact drop it correctly."
Indeed.
I think there are two possibilities to handle the situation:
while dragging, if the mouse starts hovering over the forbidden area then we would prevent to drag further left. i wanted to try this but couldn't find the proper event for dragging.
remove the event only after drop: yes that would be ok too.
In beforeDragCreateFinalize I was using e.eventRecord.end_date, and it was very close to the start_date, something like 8 minutes away from it. I didn't really get it.
I didn't try with the context dates, I will do.
Thanks all for your support.