2013-07-05 34 views
-1

我已經實現了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) { 
    } 
}); 

任何人都可以從我的代碼看到我做錯了什麼嗎?

謝謝

特里。

+0

什麼不正確?請儘量減少代碼以顯示確切的問題和/或爲其創建jsfiddle。這不是「審查我的代碼」網站。 – fsw

+0

歡迎來到計算器。對於將來的問題:請給出您使用的fullcalendar的版本,我同意@fsw您需要儘量減少您發佈的代碼量。這應該包括您調用的相關自定義函數(例如,您沒有給出'GetDuration'的代碼)。 – mabi

回答

0

受過教育的猜測:在events數組中指定end。你給duration,但這不是根據規範standard attribute

+0

謝謝你Mabi!我沒有意識到,我已經刪除了最終參數。這解決了謝謝。 – user2552803

+0

不客氣。 – mabi