仅显示月视图中的allDay事件完整日历

时间:2012-05-23 09:11:49

标签: fullcalendar

如何在完整日历月视图中仅显示allDay = true事件,并在其他视图中仅显示所有Day事件为usal

2 个答案:

答案 0 :(得分:2)

您可以通过在eventRender之类的回调中检查view.name来执行此操作。看看这个小提琴:http://jsfiddle.net/100thGear/vyKSZ/

希望这有帮助!

答案 1 :(得分:0)

 $('#external-events div.external-event').each(function() {
        // store data so the calendar knows to render an event upon drop
        $(this).data('event', {
            title: $.trim($(this).text()), // use the element's text as the event title
            stick: true // maintain when user navigates (see docs on the renderEvent method)
        });
        // make the event draggable using jQuery UI
        $(this).draggable({
            zIndex: 1111999,
            revert: true,      // will cause the event to go back to its
            revertDuration: 0  //  original position after the drag
        });
    });
    /* initialize the calendar
     -----------------------------------------------------------------*/
    var date = new Date();
    var d = date.getDate();
    var m = date.getMonth();
    var y = date.getFullYear();
    $('#calendar').fullCalendar({
        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,agendaWeek'
        },
        editable: true,
        droppable: true, // this allows things to be dropped onto the calendar
        drop: function() {
            // is the "remove after drop" checkbox checked?
            if ($('#drop-remove').is(':checked')) {
                // if so, remove the element from the "Draggable Events" list
                $(this).remove();
            }
        },
        eventDrop: function(event, delta, revertFunc) {
            alert( event.id );
            $.ajax({
                type: "POST",
                url: "${pageContext.request.contextPath}/task/periodic-task-update",
                data : {
                    id : event.id , 
                    date :event.start.format()
                },
                success: function(data) {
                     if(data=='Task Period Succesfully Changed'){
                        toastr.success("Task Period Succesfully Changed.");
                    }else{
                        toastr.success("Something Wrong");
                        revertFunc();
                    } 
                },
                error: function(data,textStatus,xhr) {
                    toastr.success("Something Wrong");
                    revertFunc();
                }       
            });
        },
        events: [
                <c:forEach var='periodicTask' items='${periodicTaskTemplates}'>
                    <c:forEach  varStatus="i" begin = "1" end = "12">
                        { id: '${periodicTask.id}', title: '${periodicTask.task}', start: new Date(y,  '${i.index}', '${periodicTask.startDate}'), end: new Date(y, '${i.index}', '${periodicTask.lastDate}') ,type:'${periodicTask.description}',location:'${periodicTask.location.name}'},
                    </c:forEach>
                </c:forEach>`
        ],
    });