选择日期后的 renderEvent 在 Fullcalendar 中不起作用
renderEvent after selecting dates not working in Fullcalendar
我想在 selection 日期范围内添加和呈现事件。 select()
被正确触发,但最后一行有错误 calendar.fullCalendar is not a function
。我在谷歌上搜索了很多,但没有找到任何可行的解决方案。
我在 timeline-view
中使用 FullCalendar v4
。
var calendar = null;
document.addEventListener('DOMContentLoaded', function() {
calendar = new FullCalendar.Calendar(document.getElementById('preview'), {
editable: true,
eventResizableFromStart: true,
eventResourceEditable: true,
selectable: true,
...
select: function(selectionInfo) {
var event = new Object();
event.title = 'title';
event.start = selectionInfo.start;
event.end = selectionInfo.end;
event.resourceId = selectionInfo.resource.id;
calendar.fullCalendar('renderEvent', event); // console says 'calendar.fullCalendar is not a function'
//$('#preview').fullCalendar('renderEvent', event); // I also tried this, but the same error as above
}
});
});
calendar.fullCalendar('renderEvent', event);
...我猜你是从某处复制的?因为这是 fullCalendar version 3 语法。对于版本 4 你会写
calendar.addEvent(event);
有关文档,请参阅 https://fullcalendar.io/docs/Calendar-addEvent。始终检查您找到的示例是否适用于正确的软件版本。
我想在 selection 日期范围内添加和呈现事件。 select()
被正确触发,但最后一行有错误 calendar.fullCalendar is not a function
。我在谷歌上搜索了很多,但没有找到任何可行的解决方案。
我在 timeline-view
中使用 FullCalendar v4
。
var calendar = null;
document.addEventListener('DOMContentLoaded', function() {
calendar = new FullCalendar.Calendar(document.getElementById('preview'), {
editable: true,
eventResizableFromStart: true,
eventResourceEditable: true,
selectable: true,
...
select: function(selectionInfo) {
var event = new Object();
event.title = 'title';
event.start = selectionInfo.start;
event.end = selectionInfo.end;
event.resourceId = selectionInfo.resource.id;
calendar.fullCalendar('renderEvent', event); // console says 'calendar.fullCalendar is not a function'
//$('#preview').fullCalendar('renderEvent', event); // I also tried this, but the same error as above
}
});
});
calendar.fullCalendar('renderEvent', event);
...我猜你是从某处复制的?因为这是 fullCalendar version 3 语法。对于版本 4 你会写
calendar.addEvent(event);
有关文档,请参阅 https://fullcalendar.io/docs/Calendar-addEvent。始终检查您找到的示例是否适用于正确的软件版本。