简体   繁体   English

使用多个文件在jQuery FullCalendar中获取事件

[英]Using multiple files for fetching events in jQuery FullCalendar

I am implementing jQuery FullCalendar in my Symfony2 site but I need to be able to show events from two different sources, and highlight them in different colours so the front end user can differentiate between each type. 我正在Symfony2网站上实现jQuery FullCalendar,但我需要能够显示来自两个不同来源的事件,并以不同的颜色突出显示它们,以便前端用户可以区分每种类型。

Currently, I am using this code in my calendar settings js to fetch events from a json file: 当前,我在日历设置js中使用以下代码从json文件中获取事件:

events:
   {
     url: 'calendarjson/events.json'
   },

Here is my events.json file, if it is any help: 这是我的events.json文件,如果有帮助的话:

[{"id":1,"title":"To Do","description":"Edited To Do text!View call log</a>","start":"2015-10-30 14:30:00","allDay":0},{"id":2,"title":"Test Reminder","description":"asfsafasfd","start":"2015-11-10 12:00:00","allDay":0}] [{{id“:1,” title“:”待办事项“,” description“:”已编辑待办事项文本!查看通话记录</a>“,” start“:” 2015-10-30 14:30: 00“,” allDay“:0},{” id“:2,” title“:”测试提醒“,”描述“:” asfsafasfd“,”开始“:” 2015-11-10 12:00:00“ ,“ allDay”:0}]

However, I need to be able to fetch data from another file which contains driver sheets for a removal company, so users can see what is coming up. 但是,我需要能够从另一个文件中获取数据,该文件包含一家搬迁公司的驱动程序表,以便用户可以看到即将发生的事情。

Is there a way to allow the calendar to use two different json files to grab events from and, preferably, implement different colours for the background of the event? 有没有一种方法允许日历使用两个不同的json文件从事件中抓取事件,并且最好为事件的背景实现不同的颜色?

Thanks in advance 提前致谢

From API: 从API:

$('#calendar').fullCalendar({

    eventSources: [

        // your event source
        {
            url: '/myfeed.php', // use the `url` property
            color: 'yellow',    // an option!
            textColor: 'black'  // an option!
        },
        {
            url: '/myfeed2.php', // use the `url` property
            color: 'yellow',    // an option!
            textColor: 'black'  // an option!
        }

        // any other sources...

    ]

});

http://fullcalendar.io/docs/event_data/events_json_feed/ http://fullcalendar.io/docs/event_data/events_json_feed/

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

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