fullcalendar : updating option function callbacks after init

Posted by Paul Maneesilasan on Stack Overflow See other posts from Stack Overflow or by Paul Maneesilasan
Published on 2010-05-20T20:07:05Z Indexed on 2010/05/20 20:10 UTC
Read the original article Hit count: 343

Filed under:
|
|

Ok, so I have a problem with setting options whose values are callback functions when I try to set them after plugin initialization. I think this would be a common behavior, to dynamically set event callback after init'ing the calendar.

Here is a snipit of code:

 $(document).ready(function() {
  $('#calendar').fullCalendar({
   editable: false
   ,events:[{"title":"meeting.title","start":"2010-05-21 15:58:16 UTC"},{"title":"meeting.title","start":"2010-05-24 15:58:16", "url":"http://google.com"}]
 /*  ,eventClick: function(event) { 
              if (event.url) {
                  window.open(event.url);
                  return false;
              }
          }
   */
  });
 $('#calendar').fullCalendar('options', 'eventClick', function(event) {
          if (event.url) {
              window.open(event.url);
              return false;
          }
      });

});

You can see that I have setting the eventClick function as an init option commented out. If I do it that way, it works fine. However if I try to set it after the init, it doesn't work :(

Is the some other way to do this? Or am I stuck with having to set the behavior upfront?

© Stack Overflow or respective owner

Related posts about fullcalendar

Related posts about jQuery