Intercepting Double Click To Create Event

When a user double clicks on the calendar to create an event, I want to be able to prevent the creation of that event depending on other information that is on the same page. Preferably, I would want something like this:

scheduler.attachEvent("onSomeEvent", function() {
    if(condition) {
        return false;
    }
    return true;
});

Unfortunately, I cannot find how to do this. Here is what I have tried:

I have found scheduler.config.dblclick_create, but that isn’t what I want because I need to conditionally block the creation on double click, rather than blanket block of them all.

I tried the “onDoubleClick” event, but that only triggers when you double click an existing event.

I tried the “onBeforeEventCreated” event, but that only triggers when you drag-n-drop an event to create it.

Is there any way to accomplish this that I may have missed?

Thanks!

-PNG

Hello,
unfortunately there is no API event that would do what you need in all modes of the scheduler.
You can try following instead :

  1. dynamically update ‘dblclick_create’ each time the state of your page changes (i.e. when conditions that allow or disallow the double click create is changed)

  2. create a proxy over a method that adds new event on double click:

[code]var createEvent = scheduler.addEventNow;
scheduler.addEventNow = function(){
if(confirm(“really add?”)){
return createEvent.apply(scheduler, arguments);
}

return null;
}[/code]

docs.dhtmlx.com/scheduler/snippet/b6c4115f