Month view event trigger help

Hi,

I built a calendar that shows both individual events and “company” events. When someone is logged in as an individual, they can view but not modify the “company” events. I built my own lightbox to handle this.

My issue is that I made it so onBeforeDrag does a test to see if the person has access to an event, and if not, I show an alert. It works really well in the day and week views.

The problem is that in the month view, trying to double click the event calls onBeforeDrag before either onClick or onDoubleClick is called. So, there is no way for people to view these events. They keep getting the warning that they do not have access to edit it.

Is there a way to maybe ignore the drag event only in month view? I have version 2.1. I saw a “getState” method but dont’ think that I have it.

Any other ideas on how to help?

Thanks,
Rachel

Hello,

Try using the following code:

scheduler.attachEvent("onBeforeDrag", function (event_id, mode, native_event_object){ if(scheduler._mode != "month") { // custom logic for other than month views } else { // custom logic for month view } });

Best regards,
Ilya

Thank you, that works.

I realized I need one more thing to make this work. Is there a way to manually trigger the onClick event?

Basically, in month view, I want to treat all clicks as clicks, not as the beginning of a drag.

Is that possible?

Thanks,
Rachel

If you click any event in the month view then onBeforeDrag, onClick internal events will be triggered (in that order).
So you can simply block drag in the month view by returning false value.

Updated code:

scheduler.attachEvent("onBeforeDrag", function (event_id, mode, native_event_object){ if(scheduler._mode != "month") { // custom logic for other than month views } else { // month view return false; // we are blocking drag event, onClick will be triggered next } });

Hope this helps.