在Fullcalendar 2.4.0版本中添加月份列表

在Fullcalendar 2.4.0版本中添加月份列表,fullcalendar,Fullcalendar,我设法在Fullcalendar.js 2.4.0版上添加了listWeek,但如何添加listMonth 我为listWeek添加的代码如下所示 要将月列表视图添加到fullcalendar 2.4版。0 var ListView = fcViews.list = View.extend({ dayGrid: null, // the main subcomponent that does most of the heavy lifting weekNumberWidth: n

我设法在Fullcalendar.js 2.4.0版上添加了listWeek,但如何添加listMonth

我为listWeek添加的代码如下所示 要将月列表视图添加到fullcalendar 2.4版。0

var ListView = fcViews.list = View.extend({
    dayGrid: null, // the main subcomponent that does most of the heavy lifting
    weekNumberWidth: null, // width of all the week-number cells running down the side
    headRowEl: null, // the fake row element of the day-of-week header
    //defultEventLimit: 5, //we need to show some events in each cell 
    viewDateOnLeft: false, //true to display date on left, false to display above the day
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
},

// Sets the display range and computes all necessary dates
setRange: function(range) {
    View.prototype.setRange.call(this, range); // call the super-method

    this.dayGrid.breakOnWeeks = /year|month|week/.test(this.intervalUnit); // do before setRange
    this.dayGrid.setRange(range);
},

// Renders the view into `this.el`, which should already be assigned.
renderDates: function() {
    this.dayGrid.colCnt = 1;
    this.dayGrid.rowCnt = this.dayGrid.cellDates.length;
    this.dayGrid.numbersVisible = true;

    if (this.opt('viewDateOnLeft')) {
        this.viewDateOnLeft = this.opt('viewDateOnLeft');
        this.el.removeClass('fc-display-date-above');
    } else {
        this.el.addClass('fc-display-date-above');
    }

    this.el.addClass('fc-basic-view').html(this.renderHtml());

    this.headRowEl = this.el.find('thead fc-row');

    this.scrollerEl = this.el.find('.fc-day-grid-container');
    this.dayGrid.coordMap.containerEl = this.scrollerEl; // constrain clicks/etc to the dimensions of the scroller

    this.dayGrid.el = this.el.find('.fc-day-grid');
    this.dayGrid.renderDates(this.hasRigidRows());
},

// Make subcomponents ready for cleanup
unrenderDates: function() {
    this.dayGrid.unrenderDates();
    this.dayGrid.removeElement();
},


// Builds the HTML skeleton for the view.
renderHtml: function() {
    return '' +
        '<div class="' + this.widgetContentClass + '">' +
        '<div class="fc-day-grid-container">' +
        '<div class="fc-day-grid"/>' +
        '</div>' +
        '</div>';
},


// Generates the HTML that will go before the day-of week header cells.
// Queried by the DayGrid subcomponent when generating rows. Ordering depends on isRTL.
headIntroHtml: function() {
    if (this.viewDateOnLeft === true) {
        return '' +
            '<th class="fc-week-number ' + this.widgetHeaderClass + '" ' + this.weekNumberStyleAttr() + '>' +
            '<span>' +
            '</span>' +
            '</th>';
    } else {
        return '';
    }
},


// Generates the HTML that will go before content-skeleton cells that display the day/week numbers.
// Queried by the DayGrid subcomponent. Ordering depends on isRTL.
numberIntroHtml: function(row) {
    if (this.viewDateOnLeft === true) {
        return '' +
            '<td class="fc-week-number" ' + this.weekNumberStyleAttr() + '>' +
            '<span>' + // needed for matchCellWidths
            this.dayGrid.getCell(row, 0).start.format('ddd MMM D, YYYY') +
            '</span>' +
            '</td>';
    } else {
        return '';
    }
},


// Generates the HTML that goes before the day bg cells for each day-row.
// Queried by the DayGrid subcomponent. Ordering depends on isRTL.
dayIntroHtml: function() {
    if (this.viewDateOnLeft === true) {
        return '<td class="fc-week-number ' + this.widgetContentClass + '" ' +
            this.weekNumberStyleAttr() + '></td>';
    } else {
        return '';
    }
},


// Generates the HTML that goes before every other type of row generated by DayGrid. Ordering depends on isRTL.
// Affects helper-skeleton and highlight-skeleton rows.
introHtml: function() {
    if (this.viewDateOnLeft === true) {
        return '<td class="fc-week-number" ' + this.weekNumberStyleAttr() + '></td>';
    } else {
        return '';
    }
},


// Generates the HTML for the <td>s of the "number" row in the DayGrid's content skeleton.
// The number row will only exist if either day numbers or week numbers are turned on.
numberCellHtml: function(cell) {
    if (this.viewDateOnLeft === true) {
        return '<td/>';
    } else {
        var date = cell.start;
        var classes;

        classes = this.dayGrid.getDayClasses(date);
        classes.unshift('my-fc-header');
        return '' +
            '<div class="' + classes.join(' ') + '" data-date="' + date.format() + '">' +
            '<span class="my-fc-header-day">' +
            date.format('dddd') +
            '</span>' +
            '<span class="my-fc-header-date">' +
            date.format('DD-MM-YYYY') +
            '</span>' +
            '</div>';
    }
},


// Generates an HTML attribute string for setting the width of the week number column, if it is known
weekNumberStyleAttr: function() {
    if (this.weekNumberWidth !== null) {
        return 'style="width:' + this.weekNumberWidth + 'px"';
    }
    return '';
},


// Determines whether each row should have a constant height
hasRigidRows: function() {
    var eventLimit = this.opt('eventLimit');
    if (eventLimit === true) {
        eventLimit = this.defultEventLimit;
    }

    return eventLimit && typeof eventLimit !== 'number';
},


/* Dimensions
------------------------------------------------------------------------------------------------------------------*/


// Refreshes the horizontal dimensions of the view
updateWidth: function() {
    // Make sure all week number cells running down the side have the same width.
    // Record the width for cells created later.
    this.weekNumberWidth = matchCellWidths(
        this.el.find('.fc-week-number')
    );
},


// Adjusts the vertical dimensions of the view to the specified values
setHeight: function(totalHeight, isAuto) {
    var eventLimit = this.opt('eventLimit');
    if (eventLimit === true) {
        eventLimit = this.defultEventLimit;
    }
    var scrollerHeight;

    // reset all heights to be natural
    unsetScroller(this.scrollerEl);
    uncompensateScroll(this.headRowEl);

    this.dayGrid.removeSegPopover(); // kill the "more" popover if displayed

    // is the event limit a constant level number?
    if (eventLimit && typeof eventLimit === 'number') {
        this.dayGrid.limitRows(eventLimit); // limit the levels first so the height can redistribute after
    }

    scrollerHeight = this.computeScrollerHeight(totalHeight);
    this.setGridHeight(scrollerHeight, isAuto);

    // is the event limit dynamically calculated?
    if (eventLimit && typeof eventLimit !== 'number') {
        this.dayGrid.limitRows(eventLimit); // limit the levels after the grid's row heights have been set
    }

    if (!isAuto && setPotentialScroller(this.scrollerEl, scrollerHeight)) { // using scrollbars?

        compensateScroll(this.headRowEl, getScrollbarWidths(this.scrollerEl));

        // doing the scrollbar compensation might have created text overflow which created more height. redo
        scrollerHeight = this.computeScrollerHeight(totalHeight);
        this.scrollerEl.height(scrollerHeight);

        this.restoreScroll();
    }
},


// Sets the height of just the DayGrid component in this view
setGridHeight: function(height, isAuto) {
    if (isAuto) {
        undistributeHeight(this.dayGrid.rowEls); // let the rows be their natural height with no expanding
    } else {
        distributeHeight(this.dayGrid.rowEls, height, true); // true = compensate for height-hogging rows
    }
},


/* Events
------------------------------------------------------------------------------------------------------------------*/


// Sets the view's title property to the most updated computed value
updateTitle: function() {
    this.title = this.computeTitle();
},


// Computes what the title at the top of the calendar should be for this view
computeTitle: function() {
    return "Week of activity " + this.formatRange({
            start: this.intervalStart,
            end: this.intervalEnd
        },
        this.opt('titleFormat') || this.computeTitleFormat(),
        this.opt('titleRangeSeparator')
    );
},


// Renders the given events onto the view and populates the segments array
renderEvents: function(events) {
    this.dayGrid.renderEvents(events);
    //console.log(events);
    /*var out = '';
jQuery.each(events, function(key, value){
     this.dayGrid.renderEvents(value.description);
});*/

    this.updateHeight(); // must compensate for events that overflow the row

    View.prototype.renderEvents.call(this, events); // call the super-method
},

// Retrieves all segment objects that are rendered in the view
getSegs: function() {
    return this.dayGrid.getSegs();
},


// Unrenders all event elements and clears internal segment data
unrenderEvents: function() {
    this.dayGrid.unrenderEvents();

    // we DON'T need to call updateHeight() because:
    // A) a renderEvents() call always happens after this, which will eventually call updateHeight()
    // B) in IE8, this causes a flash whenever events are rerendered
},


/* Event Dragging
------------------------------------------------------------------------------------------------------------------*/


// Renders a visual indication of an event being dragged over the view.
// A returned value of `true` signals that a mock "helper" event has been rendered.
renderDrag: function(start, end, seg) {
    return this.dayGrid.renderDrag(start, end, seg);
},


// Unrenders the visual indication of an event being dragged over the view
destroyDrag: function() {
    this.dayGrid.destroyDrag();
},


/* Selection
------------------------------------------------------------------------------------------------------------------*/


// Renders a visual indication of a selection
renderSelection: function(start, end) {
    this.dayGrid.renderSelection(start, end);
},


// Unrenders a visual indications of a selection
destroySelection: function() {
    this.dayGrid.destroySelection();
}
});

;;

/* A list view with simple day cells
----------------------------------------------------------------------------------------------------------------------*/

fcViews.listWeek = {
  type: 'list',
  duration: {
    weeks: 1
  }
};

  ;;
  return fc; // export for Node/CommonJS
});
var ListView=fcViews.list=View.extend({
dayGrid:null,//执行大部分重载的主要子组件
weekNumberWidth:null,//沿边运行的所有周数单元格的宽度
headRowEl:null,//星期日标题的伪行元素
//defultEventLimit:5,//我们需要在每个单元格中显示一些事件
viewDateOnLeft:false,//true表示在左侧显示日期,false表示在日期上方显示
初始化:函数(){
this.dayGrid=新的dayGrid(this);
this.coordMap=this.dayGrid.coordMap;//视图的日期到单元格的映射与子组件的相同
},
//设置显示范围并计算所有必要的日期
设置范围:功能(范围){
View.prototype.setRange.call(this,range);//调用super方法
this.dayGrid.breaknWeeks=/year | month | week/.test(this.intervalUnit);//在设置范围之前执行
this.dayGrid.setRange(范围);
},
//将视图渲染为“this.el”,该视图应已分配。
renderDates:function(){
this.dayGrid.colCnt=1;
this.dayGrid.rowCnt=this.dayGrid.cellDates.length;
this.dayGrid.numbersVisible=true;
if(this.opt('viewDateOnLeft')){
this.viewDateOnLeft=this.opt('viewDateOnLeft');
此.el.removeClass('fc-display-date-over');
}否则{
此.el.addClass('fc-display-date-over');
}
this.el.addClass('fc-basic-view').html(this.renderHtml());
this.headlowel=this.el.find('thead fc row');
this.scrollerEl=this.el.find('.fc day grid container');
this.dayGrid.coordMap.Containerrel=this.scrollerEl;//将单击/etc限制为滚动条的尺寸
this.dayGrid.el=this.el.find('.fc day grid');
this.dayGrid.renderDates(this.hasRigidRows());
},
//使子构件准备好进行清理
未描述:函数(){
this.dayGrid.underderdates();
this.dayGrid.removeElement();
},
//为视图构建HTML框架。
renderHtml:函数(){
返回“”+
'' +
'' +
'' +
'' +
'';
},
//生成将在星期几标题单元格之前显示的HTML。
//生成行时由DayGrid子组件查询。排序取决于isRTL。
headIntroHtml:function(){
if(this.viewDateOnLeft==true){
返回“”+
'' +
'' +
'' +
'';
}否则{
返回“”;
}
},
//生成显示日/周数的内容框架单元格之前的HTML。
//由DayGrid子组件查询。排序取决于isRTL。
NUMBERNTROHTML:功能(行){
if(this.viewDateOnLeft==true){
返回“”+
'' +
''+//需要匹配单元格宽度
this.dayGrid.getCell(第0行).start.format('ddd-MMM-D,YYYY'))+
'' +
'';
}否则{
返回“”;
}
},
//为每一天行生成日期bg单元格之前的HTML。
//由DayGrid子组件查询。排序取决于isRTL。
dayIntroHtml:function(){
if(this.viewDateOnLeft==true){
返回“”;
}否则{
返回“”;
}
},
//生成HTML,该HTML位于DayGrid生成的所有其他类型的行之前。排序取决于isRTL。
//影响辅助对象骨架并高亮显示骨架行。
introHtml:function(){
if(this.viewDateOnLeft==true){
返回“”;
}否则{
返回“”;
}
},
//为DayGrid内容框架中的“number”行的s生成HTML。
//仅当启用了“日数”或“周数”时,“数字”行才会存在。
numberCellHtml:函数(单元格){
if(this.viewDateOnLeft==true){
返回“”;
}否则{
变量日期=cell.start;
var类;
classes=this.dayGrid.getDayClasses(日期);
class.unshift('my-fc-header');
返回“”+
'' +
'' +
date.format('dddd')+
'' +
'' +
日期格式('DD-MM-YYYY')+
'' +
'';
}
},
//生成HTML属性字符串,用于设置周数列的宽度(如果已知)
weekNumberStyleAttr:function(){
if(this.weekNumberWidth!==null){
返回'style=“width:'+this.weekNumberWidth+'px';
}
返回“”;
},
//确定每行是否应具有恒定高度
hasRigidRows:function(){
var eventLimit=this.opt('eventLimit');
if(eventLimit==true){
eventLimit=this.defultEventLimit;
}
返回eventLimit&&typeof eventLimit!='number';
},
/*尺寸
------------------------------------------------------------------------------------------------------------------*/
//刷新视图的水平尺寸
updateWidth:function(){
//确保侧面的所有周数单元格具有相同的宽度。
//记录稍后创建的单元格的宽度。
this.weekNumberWidth=匹配单元格宽度(
此.el.find(“.fc周数”)
);
},
//将视图的垂直尺寸调整为指定值
设置高度:功能(总高度,自动){
var eventLimit=this.opt('eventLimit');
if(eventLimit==true){
eventLimit=this.defultEventLimit;
}
可变卷轴高度;
//将所有高度重置为自然高度
取消设置滚动条(this.scrollerEl);
无补偿卷轴(此为头路);
this.dayGrid.removeSegPopover();//如果显示“更多”popover,请将其删除
//事件限制是一个恒定的级别数吗?
if(eventLimit&&typeof eventLimit=='number'){
this.dayGrid.limitRows(eventLimit);//首先限制标高,以便之后可以重新分布高度
}
scrollerHeight=this.compute