How can I set the minTime
and maxTime
options after the calendar is created?
I tried the following, which doesn\'t work:
$(
This way you can change as many calendar options you like:
// save the calendar options in a variable
var calendarOptions = $('#calendar')
.fullCalendar('getView')
.options;
// make your changes to the calendar options
// I wanted to change the slotDuration
calendarOptions.slotDuration = '00:20:00';
// destroy the calendar
$('#calendar')
.fullCalendar('destroy');
//Lets load the calendar with the new options
$('#calendar')
.fullCalendar(calendarOptions);
Hope this helps. Thanks.
There's an open issue for this functionality here:
https://code.google.com/p/fullcalendar/issues/detail?id=293
just me dude's answer is actually the only way I found myself.
This is just an addendum to this former answer : If you want to change the editable option, which is very useful if you want to lock the events for asking confirmation on a change before updating your database, it's a little more tricky. In case it can save some time to someone I dump the code:
var view = $('#calendar').fullCalendar('getView');
view.calendar.options.editable = false;
view.calendar.overrides.editable = false;
view.calendar.viewSpecCache.month.options.editable = false;
view.calendar.viewSpecCache.agendaWeek.options.editable = false;
view.calendar.viewSpecCache.agendaDay.options.editable = false;
$('#calendar').fullCalendar('render');
You obviously change all those false to true to unlock.
I don't know if it is still relevant but I can change the options with the following statement:
example for selectable:
$('#calendar').fullCalendar('getView').calendar.options.selectable = false;
$('#calendar').fullCalendar('render'); // rerender to see visual changes
Though it's not dynamically but at least you don't have to destroy the whole calendar and refetch your events :-)
This code just did fine for me. Call this function anywhere and pass as many custom variables to it, but don't forget to destroy the previous calendar first
function initializeCalendar( timeIntervalCustom ) {
$('#calendar'+id).fullCalendar({
slotMinutes: timeIntervalCustom,
});
}
$('#calendar').fullCalendar("destroy");
initializeCalendar(10);
This functionality has been officially release in v2.9.0: http://fullcalendar.io/docs/utilities/dynamic_options/