2012-02-07 29 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) 
       } 

      } 
     } 
}); 
相关问题