Handle dblclick in Fullcalendar jQuery plugin

adamfinstorp picture adamfinstorp · Nov 14, 2011 · Viewed 26k times · Source

I know that this question has been asked before, but several new versions have been released since then.

Is it possible to handle a dblclick event for creating a new appointment in the calendar without having to modify the fullcalendar.js file? It would be great to handle this extension in a separate file together with my other tweaks.

Thanks in advance!

/Adam

Answer

Juan Gonzales picture Juan Gonzales · Nov 15, 2011

Adam's post at https://code.google.com/p/fullcalendar/issues/detail?id=231 uses this solution.

whenever possible i like to keep things out of the core of fullcalendar, and have people do them through the api. the only reason i have eventClick/eventMouseover/eventMouseout as part of the core is b/c they involve some special cases, such as conflicting with jquery ui dragging & resizing, so i need to do things like check for those classes.

i think the best way to attach event handlers like dblclick would be through eventRender like so:

$('#calendar').fullCalendar({
   eventRender: function(event, element) {
      element.bind('dblclick', function() {
         alert('double click!');
      });
   }
})

please let me know if you feel differently. thanks

I have the newest update and this works great for me.