切换月份时,我想停止fullcalendar删除事件

时间:2013-11-25 14:08:11

标签: jquery backbone.js fullcalendar

传递fullCalendar一系列事件可确保在切换月份时不会删除这些事件。

但是,假设您不是按月加载事件,而是按其他方式加载事件。例如,假设您要加载当年的所有用户事件。我们还假设您可以在加载页面后动态添加用户。

现在有动态加载的事件,每次切换月份时,fullCalendar都会删除事件。

如何强制fullCalendar让在和哪些事件被删除时处理

编辑我觉得我遗漏了文档中非常重要的内容。但对于我的生活,我没有在文档中看到任何阻止fullCalendar删除事件的内容。

我现在有什么:

// Initialize the calendar
$('#calendar').fullCalendar();

// Represents a list of all the events currently on the calendar
this.events = new Backbone.Collection();

// Add and removal events for this collection
this.events.on('add', function( ev ) {
    // We need to check to make sure the calendar is initialized
    if ( $('#calendar').children().length > 0 ) {
        // Calendar is initialized, let's add our event
        $('#calendar').fullCalendar('renderEvent', ev.attributes );
    }
});

1 个答案:

答案 0 :(得分:0)

Aaaand我在文档中找到了我所遗漏的内容!

http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/