How can I set Fullcalendar options dynamically

后端 未结 7 703
广开言路
广开言路 2020-12-17 16:22

How can I set the minTime and maxTime options after the calendar is created?

I tried the following, which doesn\'t work:

$(         


        
7条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-17 16:33

    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.

提交回复
热议问题