Fullcalendar V4-清除所有事件 [英] Fullcalendar V4 - clear all events

查看:553
本文介绍了Fullcalendar V4-清除所有事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从JSON源加载动态事件,但是每次单击不同的房间时,我想先清除所有事件,然后再获取新事件

I'm loading dynamic events from a JSON source, but each time I click a different room, I want to clear all the events prior to fetching the new ones

我尝试清除eventSource,但无济于事

I have attempted to clear the eventSource but to no avail

var eventSource = calendar.getEventSources()
eventSource.remove();

这会导致错误:

Uncaught TypeError: eventSource.remove is not a function

我有

推荐答案

您绝对会发现,我收拾东西的日子特别慢!

You are absolutely spot on, I'm having a particularly slow day on picking things up!

var eventSources = calendar.getEventSources(); 
var len = eventSources.length;
for (var i = 0; i < len; i++) { 
    eventSources[i].remove(); 
} 

作为解决方案,正如您建议的@ADyson

Was the solution, as you suggested @ADyson

这篇关于Fullcalendar V4-清除所有事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆