Javascript fullcalendar在视图更改时执行某些操作

Javascript fullcalendar在视图更改时执行某些操作,javascript,view,fullcalendar,onchange,Javascript,View,Fullcalendar,Onchange,当视图发生变化时,我需要做些什么。例如,从motnh到AGENDAY 没用了。有什么想法吗 viewRender:(function() { var lastViewName; return function(view) { var view = $('#calendar').fullCalendar('getView'); alert('The n

当视图发生变化时,我需要做些什么。例如,从motnh到AGENDAY

没用了。有什么想法吗

viewRender:(function() {

                var lastViewName;
                return function(view) {

                    var view = $('#calendar').fullCalendar('getView');
                    alert('The new title of the view is ' + view.title);
                }
            }),


代码中的小错误。您希望
()
中的函数返回另一个函数,但它没有运行。正确的形式是:

(function() {
    return function(){...};
})(); //extra parentheses run the function
这被称为一个


当您执行以下操作时,您的代码可以工作:

viewRender: (function () {
    var lastViewName;
    return function (view) {
        var view = $('#calendar').fullCalendar('getView');
        alert('The new title of the view is ' + view.title);
    }
})(),
虽然有点晚,但不妨尝试:

eventAfterAllRender:(函数(视图){


}),

从v4开始,此函数已被弃用
viewRender: (function () {
    var lastViewName;
    return function (view) {
        var view = $('#calendar').fullCalendar('getView');
        alert('The new title of the view is ' + view.title);
    }
})(),
// your code