如何在创建日历后设置minTime
和maxTime
选项?
我尝试了以下操作,但不起作用:
$('#calendar').fullCalendar('option', 'minTime', 7);
$('#calendar').fullCalendar('render');
答案 0 :(得分:15)
我不知道它是否仍然相关,但我可以使用以下声明更改选项:
可选择的例子:
$('#calendar').fullCalendar('getView').calendar.options.selectable = false;
$('#calendar').fullCalendar('render'); // rerender to see visual changes
虽然它不是动态的,但至少你不必销毁整个日历并重新制作你的活动: - )
答案 1 :(得分:4)
如果不重新创建日历,则无法完成。
<强>更新强> 可以在第2.9版中完成:请参阅below
答案 2 :(得分:4)
此功能已在v2.9.0中正式发布:http://fullcalendar.io/docs/utilities/dynamic_options/
答案 3 :(得分:3)
这样您就可以更改任意数量的日历选项:
// 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);
希望这会有所帮助。感谢。
答案 4 :(得分:2)
这里有一个关于此功能的未解决问题:
答案 5 :(得分:1)
这只是前一个答案的附录: 如果要更改可编辑选项,如果要在更新数据库之前锁定事件以确认更改,这非常有用,这有点棘手。如果它可以节省一些时间给我转储代码:
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');
你显然将所有那些false改为true以解锁。
答案 6 :(得分:0)
这段代码对我来说很好。在任何地方调用此函数并将尽可能多的自定义变量传递给它,但不要忘记先销毁之前的日历
function initializeCalendar( timeIntervalCustom ) {
$('#calendar'+id).fullCalendar({
slotMinutes: timeIntervalCustom,
});
}
$('#calendar').fullCalendar("destroy");
initializeCalendar(10);