Using fullcalendar I need without page reloading to change slotDuration
parameter depending on other conditions:
I do in one case
$('#calendar').fullCalendar('option', 'slotDuration', '00:15:00');
and in other case
$('#calendar').fullCalendar('option', 'slotDuration', '00:30:00');
But looks like it does not work, as I always see fullcalendar with slotDuration=30
(2 slots) minutes, as it was called when initialized.
If there is a way for this?
Now, you can set dynamically
without destorying the calendar
.
$('#cc-calendar')
.fullCalendar('option','slotDuration','00:10:00');
Here, we work with the Dynamically get/set Options
feature of fullcalendar
.
For more info, check out : https://fullcalendar.io/docs/utilities/dynamic_options/
Good Luck.
As you can see here, fullCalendar only allow change some properties after initialization. You don't need to reload the page, but destroy and init is required.
So:
var calendarOptions = {
defaultView: 'month',
editable: true,
slotDuration: '00:45:00',
(...)
}
$('#calendar').fullCalendar(calendarOptions); //Init
//And when you need to update any property
calendarOptions.slotDuration = '00:15:00';
$('#calendar').fullCalendar('destroy');
$('#calendar').fullCalendar(calendarOptions);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With