JQuery完整日历 - 初始化后编辑日历视图 [英] JQuery Full Calendar - edit calendar view after initialization

查看:108
本文介绍了JQuery完整日历 - 初始化后编辑日历视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在脚本的开头,我有很多传递给日历的选项。

At the beginning of the script, I have many options passed on to the calendar.

初始化完成后,执行以下操作不会更改现有日历的视图,但会创建新日历: p>

After it is initialized, executing the following doesn't change the view of the existing calendar, but creates a new calendar instead:

$('.calendar-container').fullCalendar({
   defaultView: 'agendaWeek'
});

问题:如何更改已存在的日历视图 .calendar-container div?

Question: how do I change the view of the calendar which already exists in the .calendar-container div?

推荐答案

FullCalendar只支持更改初始化后的几个选项,如高度 contentHeight and 的aspectRatio 。如果您想更改其他选项,则应销毁当前日历,并初始化FullCalendar再次使用新的选项。

FullCalendar only supports change of a few options after initialization, like height, contentHeight and aspectRatio. If you want to change other options, you should destroy the current calendar, and initialize FullCalendar again with the new options.

您可能想要记住当前状态,以便在日历销毁后重新创建它。将此回调包含在FullCalendar选项中,并将该视图保存到日历销毁后可访问的某个变量中:

You might want to remember the current state, so you can recreate it after the calendar has been destroyed. Include this callback in your FullCalendar options, and save the view in some variable that you can access after the calendar has been destroyed:

viewDisplay: function(view) {
    latestView = view;
}

然后,您可以在日历重新初始化后调用这些方法,然后重新创建状态日历在(像相同的视图和日期范围):

Then you can call these methods after the calendar has been reinitialized, and recreate the state the calendar was in (like the same view and date range):

$("#calendar").fullCalendar('changeView', latestView.name);
$("#calendar").fullCalendar('gotoDate', latestView.start);

这篇关于JQuery完整日历 - 初始化后编辑日历视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆