Jorgi Pons
Jorgi Pons

Reputation: 31

fullCalendar v5 eventOverlap resource

I'm trying to check if events are overlaping at same resource.

Is there any way in eventOverlap function to get stillEvent and movingEvent resourceId where each event are positiones at overlapping moment?

I tried this but everything is undefined:

eventOverlap: function (stillEvent, movingEvent) {
        console.log(stillEvent.resource);
        console.log(movingEvent.resource);
        console.log(stillEvent.resourceId);
        console.log(movingEvent.resourceId);
}

If overlapping is in same resource then i need to return false, else i will return true.

Upvotes: 1

Views: 385

Answers (1)

ADyson
ADyson

Reputation: 62078

To achieve what you want you can just set

eventOverlap: false

This will stop events in the same resource being allowed to overlap. Events which are in another resource are already considered as not (potentially) overlapping.

Demo: https://codepen.io/ADyson82/pen/PoZeov

N.B. you cannot use eventOverlap to compare events in different resources, because the eventOverlap callback will not be triggered if an event is dragged onto a specific time period which overlaps with an event in another resource - as I said above, this is not considered by fullCalendar to be a potential overlap.

Upvotes: 1

Related Questions