2014-11-20 3 views
1

임 심 symfony2.5 프레임 워크에서 작동합니다. 내 응용 프로그램에서 전체 calendar.js jquery 플러그인으로 구현 된 달력 페이지가 있습니다. (http://fullcalendar.io/). 직원 이벤트 레코드가있는 이벤트 테이블이 있습니다.캘린더 페이지에서 일정을 표시하는 방법

캘린더 페이지에 이러한 일정을 표시하는 방법.

내 캘린더 페이지의 JS :

$('.calendar').fullCalendar({ 
     header: { 
      left: 'prev,next,today', 
      center: 'title,', 
      right: 'month,agendaWeek,agendaDay' 
     } 
}); 

이 사람이 나를 도울 수 있습니까? 미리 감사드립니다.

답변

2

먼저 당신이 event documentation

var myEvent = {id: 1, title: 'myTitle', start: moment(...)} 

그런 다음, fullCalendar 이벤트 객체로 이벤트를 구문 분석해야합니다, 당신은

var mySourceEvents = [myEvent, myOtherEvent]; 

마지막으로 ... 배열, 기능, JSON에 해당 이벤트를 추가한다 fullcalendar config의 해당 배열을 소스로 설정할 수 있습니다.

$('#calendar').fullCalendar({ 
    eventSources: [ 
     mySourceEvents 
    ] 
}); 

또는 ... 당신은 배열로 직접 이벤트를 추가 할 수 있습니다

$('#calendar').fullCalendar({ 
    events: [ 
     { 
      title : 'event1', 
      start : '2010-01-01' 
     }, 
     { 
      title : 'event2', 
      start : '2010-01-05', 
      end : '2010-01-07' 
     }, 
     { 
      title : 'event3', 
      start : '2010-01-09T12:30:00', 
      allDay : false // will make the time show 
     } 
    ] 
}); 
관련 문제