In fullCalendar change slotDuration without page reloading

蹲街弑〆低调 提交于 2019-12-03 16:26:00

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.

Mario Levrero

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);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!