2010-08-16 2 views
2

캘린더의 기존 이벤트 (내가 클릭하는 이벤트)를 업데이트하기 위해 호출하거나 처리해야하는 이벤트 또는 메서드 이름은 무엇입니까?이벤트를 만든 후 jquery FullCalendar 약속을 업데이트하는 방법

var calendar = $('#calendar'); 
var curr_event = null; 
calendar.fullCalendar({ 
    ... 

    events: [], 
    eventClick: function(event, jsEvent, view) { 
     curr_event = event; 
     show_form_or_something(); 
    }, 

    ... 
}); 

당신은 이벤트 속성을 수정하려면 사용자를 허용하기 위해 폼 또는 무언가를 표시 할 수 있습니다 전체 일정 당신이 FullCalendar 인스턴스를 초기화하면 eventClick 처리기를 바인딩 http://arshaw.com/fullcalendar/

답변

3

여기에서 찾을 수 있습니다 (제목, 시작 등).

$.extend(curr_event, { 
    title: 'New Event Title', 
    start: new Date() 
}); 
calendar.fullCalendar('updateEvent', curr_event); 

을 그리고 jmeho 문제 해결 : 그런 다음 다시 FullCalendar 인스턴스에서 이벤트를 업데이트 당신도 renderEvent() 또는 이벤트 소스를 통해 FullCalendar 할 수있는 이벤트를 추가 할 때

를, 각 이벤트에 대한 id을 지정할 수 있습니다. 당신이 이벤트를 추가 한 후에는 사용하여 이벤트 해시/객체를 검색 할 수 있습니다

var event_obj = calendar.fullCalendar('clientEvents', 'specific event id'); 

그런 다음 당신은있다/객체를 수정하고 FullCalendar 표시를 업데이트 할 updateEvent() 메소드를 사용할 수 있습니다.

1

이 코드는 이벤트를 업데이트 한 후 캘린더를 업데이트하는 데 적합합니다.
먼저 날짜 이벤트를 제거한 다음 다시 렌더링하십시오.

function updateCalenderUP(id, title, Sessiontitle, SessionStart, Sessionend, color) {  
    title = title; 
    var id1 = id; 

    $('#calendar').fullCalendar('removeEvents', id1); 
    $('#calendar').fullCalendar('refresh'); 
    title = title; 

    if (title) { 
     calendar.fullCalendar('renderEvent', { 
       id: Eventid, 
       title: title, 
       start:startDate, 
       end: EndDate,         
       allDay: false, 
       backgroundColor:color 
      }, true // make the event "stick" 
     ); 
    } 
    calendar.fullCalendar('unselect'); 
} 
관련 문제