事件不跨越几天

时间:2013-07-05 07:57:46

标签: fullcalendar

我已经实现了fullcalendar,除了2个问题之外它还能正常工作(我会在另一个问题中提出第二个问题)。

我无法添加图片,因为我没有声誉!所以为了解释我的意思,我的活动从7月3日上午10点到7月5日上午10点。按月查看时,它仅显示在7月3日,不会跨越4日或5日。

这是我的实施代码;

$('#calendar').fullCalendar({
    events:function(start, end, callback) {
        $.ajax({
            type: "POST",
            url: 'webservices/wsEvents.asmx/GetEventsBetweenDates',
            contentType: "application/json",
            dataType: "json",
            data:  formatCalendarDates(start, end),
            success: function (doc) {
                var events = [];
                $.each(doc.d, function() {
                    var duration = GetDuration($(this).attr('StartTime'), $(this).attr('EndTime'), true);
                    var allday = moment.duration(moment($(this).attr('EndTime'))-moment($(this).attr('StartTime'))).days() >=1 ? true : false;
                    //    duration.toLowerCase().indexOf("day") >= 0 ? true : false;
                    events.push({
                        title: replaceCharacter($(this).attr('Title'), "/u0027", "'"),
                        start: $(this).attr('StartTime'),
                        id: $(this).attr('ID'),
                        description: replaceCharacter($(this).attr('Description'),"/u0027","'"),
                        allDay: allday,
                        locationID: $(this).attr('Location'),
                        location: replaceCharacter($(this).attr('LocationName'), "/u0027", "'"),
                        duration: duration
                    });
                });
                callback(events);
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                //     debugger;
                ShowError("Error: " + textStatus);
            }
        });
    },
    theme: true,
    header: {
        left: 'prevYear,prev,next,nextYear today',
        center: 'title',
        right: 'month,agendaWeek,agendaDay'
    },
    buttonIcons:{
        prevYear: "ui-icon ui-icon-triangle-1-w",
        prev: "ui-icon ui-icon-carat-1-w",
        next: "ui-icon ui-icon-carat-1-e",
        nextYear: "ui-icon ui-icon-triangle-1-e"
    },
    editable: false,
    allDaySlot: true,
    allDayDefault: false,
    firstDay: 1,
    timeFormat: {
        month: "H:mm",
        week: "",
        day: ""
    },
    weekNumbers: true,
    weekNumberCalculation: "iso",
    weekMode: "liquid",
    weekNumberTitle: "Wk",
    defaultView: "month",
    firstHour: 0,
    buttonText: {
        today: 'today',
        month: 'month',
        week: 'week',
        day: 'day'
    },
    columnFormat: {
        month: 'ddd',    // Mon
        week: 'ddd d/M', // Mon 9/7
        day: 'dddd d/M'  // Monday 9/7
    },
    eventClick: function (date, allDay, jsEvent, view) {
        DisplaySingleEvent(date, false)
    },
    eventMouseover: function (event, jsEvent, view) {
        $(this).css('cursor', 'pointer')
    },
    eventMouseout: function (date, allDay, jsEvent, view) {
        $(this).css('cursor', 'default')
    },
    eventRender: function (event, element) {
    },
    viewDisplay: function (view) {
    }
});

任何人都可以从我的代码中看到我做错了吗?

由于

特里。

1 个答案:

答案 0 :(得分:0)

受过教育的猜测:在events数组中指定end。您提供duration但根据规范,这不是standard attribute