在创建事件后如何更新jquery FullCalendar约会

什么是我必须调用或处理以更新日历中现有事件的事件或方法名称(我点击的事件)。 完整的日历可以在这里找到http://arshaw.com/fullcalendar/

初始化FullCalendar实例时,绑定eventClick处理程序:

var calendar = $('#calendar'); var curr_event = null; calendar.fullCalendar({ ... events: [], eventClick: function(event, jsEvent, view) { curr_event = event; show_form_or_something(); }, ... }); 

您可能希望显示表单或某些内容,以允许用户修改事件属性(标题,开始等)。 然后在FullCalendar实例中更新事件:

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

并解决jmeho问题:

通过renderEvent()或事件源将事件添加到FullCalendar时,可以为每个事件指定id 。 添加事件后,您可以使用以下命令检索事件哈希/对象:

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

然后,您可以修改has / object并使用updateEvent()方法更新FullCalendar显示。

此代码非常适合在更新事件后更新日历。
首先删除日期事件,然后再次渲染它。

 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'); }