是否可以将月视图扩展为空FC.View.extend? (完整日历)

时间:2015-02-10 07:54:12

标签: fullcalendar

我想我错过了一些东西,或者我只是不明白它是如何运作的。

我可以做这样的事吗。

var CustomView = fcViews.basic.extend({}); 要么 var CustomView = BasicView.extend({});

或根据文件http://fullcalendar.io/docs/views/Custom_Views/ 你只能这样做var CustomView = View.extend({});

2 个答案:

答案 0 :(得分:0)

你需要从fullCalendar.View类继承,不管你如何命名它。

var FC = $.fullCalendar; // a reference to FullCalendar's root namespace
var View = FC.View;      // the class that all views must inherit from

您需要扩展该示例中名为View

的对象

答案 1 :(得分:0)

这是我创建自定义视图的方式:

var TwoWeeks = fcViews.twoweeks = BasicView.extend({
    // Computes the new date when the user hits the prev button, given the current date
    initialize: function() {
        this.dayGrid = new DayGrid(this);
        this.coordMap = this.dayGrid.coordMap; // the view's date-to-cell mapping is identical to the subcomponent's

        // subclasses can implement
        var navJump = this.opt('twoWeekNavJump');
        if (navJump) {
            this.intervalDuration = moment.duration({'weeks': navJump});
        }
    }
});