As part of a development project using FullCalendar, I needed to change the value of “slotMinutes” using a browser event (onClick). After some battle, I was able to find a way.
A) I have a renderCalendar () function that contains a jQuery function for building a calendar. Inside this function there is a parameter for "slotMinutes", which I point to is a variable initialized to 30.
; slotTime = 30;
...
renderCalendar () function {
. $ ('# Calendar') fullCalendar ({
firstHour: 8,
minTime: 6,
maxTime: 18,
slotMinutes: parseInt (slotTime),
defaultView: 'AgendaWeek',
...
});
B) The function of my event handler changes the value of slotTime, destroys the current calendar, and restarts the rendering function.
function changeSlotTime (slottime) {
slotTime = slottime;
$ ('# calendar') fullCalendar ('destroy') ;.
renderCalendar ();
}
C) A tough battle with this change was the understanding that the value of "slotMinutes" MUST BE INTEGRATED. Note the parseInt () function in the example in section (A).
source share