简体   繁体   English

使用EventSources将更多事件添加到现有的全日历中

[英]Add more events to an existing fullcalendar with EventSources

I'm working with Fullcalendar and I have an existing calendar, I want to add more events to it using the eventSources array. 我正在使用Fullcalendar,并且已有一个日历,我想使用eventSources数组向其中添加更多事件。

calendarDiv.fullCalendar({eventSources: [ { url:url ,className: "class"}] })

But this creates a new calendar instead of putting all the events on the calendar that I already have. 但这会创建一个新的日历,而不是将所有事件都放在我已经拥有的日历上。 Can someone tell me how to add more events to the calendar using this? 有人可以告诉我如何使用此功能将更多事件添加到日历吗? thank you. 谢谢。

I think you are overwriting all of the calendar events. 我认为您正在覆盖所有日历事件。

I believe you want addEventSource. 我相信您想要addEventSource。 https://fullcalendar.io/docs/event_data/addEventSource/ https://fullcalendar.io/docs/event_data/addEventSource/

calendarDiv.fullCalendar('addEventSource', [
        {
            title  : 'event1',
            start  : '2010-01-01'
        },
        {
            title  : 'event2',
            start  : '2010-01-05',
            end    : '2010-01-07'
        },
        {
            title  : 'event3',
            start  : '2010-01-09T12:30:00',
            allDay : false // will make the time show
        }
    ])

Using the eventSources to add additional sources is not the proper way. 使用eventSources添加其他来源不是正确的方法。 The proper way, like Will said, is to use addEventSource , you're just not using it correctly. 就像Will所说的那样,正确的方法是使用addEventSource ,只是您没有正确使用它。 Since you have a URL you just need to pass the URL: 由于您有一个URL,因此只需要传递该URL:

calendarDiv.fullCalendar('addEventSource', url);

Aditionally, if you want a specific className you should add that to the source (back-end). 另外,如果需要特定的className ,则应将其添加到源(后端)中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM