I am trying to extend functionality of the FullCalender JS plugin. I am quite new to javascript OOP concepts as well as jQuery plugin development. In a first step I am wondering how to use and access the FullCalendar plugin. The fullCalendar
method can be called on any DOM Element while the calendar parameters can be given as JSON object:
$('#calendar').fullCalendar({
editable: true, // a parameter
events: "./events.php", // some events
eventRender: function(event, element) { // a callback
// do something here
}
});
I tried calling this creation method again and change the callback eventRender
but it does not work. I guess its because the calendar allows only one instance active on the DOM element. But how can I change parameters and callbacks without destroying and recreating the calendar?
Furthermore I tried to access the calendar object directly but I guess due to encapsulation it is not exposed through the FullCalendar. In contrast I see that the fullCalendar
function can be called with a string specifying a method to be called on the Calendar. Is this a common mechanism on plugin encapsulation?