创建日历后更改默认日期(fullcalendar)

Change defaultDate after Calendar is created (fullcalendar)

我正在将名为 fullcalendar (fullcalendar page) 的 JavaScript 日历集成到我的 SAPUI5 网页中。日历在特定选项卡中运行。 我现在想在创建日历后更改默认日期,以显示特定月份。

setCalendar : function () {
    var that = this;
    if(!this.todayDate) {
        this.todayDate = new Date();
    }

    $("#EventBrowserDetail--calendarDiv").fullCalendar({
        header: {
            left: 'today',
            center: 'prev title next',
            right: 'month,basicWeek,basicDay'
        },
        defaultDate: that.todayDate,
        editable: false,
        eventLimit: true, // allow "more" link when too many events
        lazyFetching: false,
        eventClick: function(event, jsEvent, view){
            that.campaignSelectHandler(event.id, true, that);
        },
        eventMouseover: function(event, jsEvent, view)
        events: that.eventArray
    });
    [...]
},

我使用 this.todayDate 在调用函数 setCalendar() 之前更改开始日期。它第一次工作正常,但如果日历已经创建,一旦它保留在最后显示的月份。 例如:显示的是八月,我切换到另一个选项卡并将月份更改为二月。之后我重新渲染事件并再次调用 setCalendar(),但它仍然停留在八月。

有什么想法and/or有帮助吗?

提前致谢! :)

由于日历实例已经存在,您可以使用以下命令告诉插件转到特定日期:

$('#EventBrowserDetail--calendarDiv').fullCalendar('gotoDate', that.todayDate);

参考:http://fullcalendar.io/docs/current_date/gotoDate/