在完整日历中显示默认标题

To display the default Title in Full calendar

如果在完整日历中找不到事件,则需要将默认标题放入日历中。

$(document).ready(function(){
    var eventMap=[];
    <c:forEach items="${fullCalendarList}" var="inspectorCal">  
            '<fmt:parseDate pattern="dd/MM/yyyy" value="${inspectorCal.end}" var="parsedDate"/>'
            '<c:url value="/secured/inspection/program/showViewInspectorPopUp" var="url"><c:param name="inspectionId">${inspectorCal.id}</c:param><c:param name="inspectionDt">${inspectorCal.start}</c:param></c:url>'
              eventMap.push({
                    "title": '${inspectorCal.title}',
                    "start": new Date('<fmt:formatDate pattern="yyyy" value="${parsedDate}" />', 
                            '<fmt:formatDate pattern="MM" value="${parsedDate}" />'-1, 
                            '<fmt:formatDate pattern="dd" value="${parsedDate}" />'),
                            "textColor": '#000000',
                            "url":'${url}',
                            <c:if test = "${inspectorCal.title == 'Annual Leave'}">
                            "color": '#CCEEFF'
                            </c:if>
                            <c:if test = "${inspectorCal.title == 'Available'}">
                            "color": '#81C6DD'
                            </c:if>
                            </c:if>
                });
            </c:forEach>                
    $('#calendar').fullCalendar({
        year: y,
        month: m-1,
        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,agendaWeek,agendaDay'
        },
       titleFormat: {
            month: 'MMMM yyyy'
        },
        editable: true,
        events: eventMap,   
        eventClick: function(event) {
            if (event.url) {
                $(this).showDialog(event.url);
                return false;
            }
        }
    });
});

如何识别事件为空,以便我们可以将默认标题设为"Available"。我正在使用spring mvc 3.2 和full calendar 1.5.3

在 eventMap 中使用附加字段(如 emptySlot : true),并在 eventRender 中检查该字段

eventRender: function (event, element) {
    if(event.emptySlot) {
      //apply your code here
    }
}

有关更多信息,请查看文档 click here for docs