2012-02-07 59 views
0

我有這個代碼,當我切換視圖時顯示日曆上的事件,但不是日曆第一次啓動時顯示的事件。Fullcalendar不在日曆上呈現事件init

$('#calWrap').fullCalendar({ 
     header: { 
      right: 'prev,today,next', 
      left: 'title' 
     }, 
     editable: true, 
     defaultView: 'agendaWeek', 
     height: 650, 
     events: function(start, end, callback) { 
      $.ajax({ 
       url: '/calendar/getEvents', 
       dataType: 'json', 
       data: { 
        // our hypothetical feed requires UNIX timestamps 
        start: Math.round(start.getTime()/1000), 
        end: Math.round(end.getTime()/1000) 
       }, 
       success: function(doc) { 
        var events = doc; 
        callback(events); 
       } 
      }); 
     } 
}); 

我打過電話的成功處理程序$('#calWrap').fullCalendar('rerenderEvents');,但沒有奏效。這就像事件函數在日曆初始化時沒有被調用。

回答

0

試試這個

$('#calWrap').fullCalendar({ 
     header: { 
      right: 'prev,today,next', 
      left: 'title' 
     }, 
     editable: true, 
     defaultView: 'agendaWeek', 
     height: 650, 
     events: { 
       url: '/calendar/getEvents', 
       dataType: 'json', 
       data: { 
        // our hypothetical feed requires UNIX timestamps 
        start: Math.round(start.getTime()/1000), 
        end: Math.round(end.getTime()/1000) 
       } 

      } 
     } 
}); 
相關問題