English 中文(简体)
垂直资源视图, 包含多个 Google 日历中的事件
原标题:Vertical Resource View with events from multiple Google Calendar
I am trying to create a Vertical Resource View (1-day vertical resource view) with events from multiple Google Calendars. To do this, the events from a single Google Calendar each represent a resource. All Google Calendars come from a single Google Account, so only one API key. I have currently integrated these as described in the documentation: googleCalendarApiKey: api-key , eventSources: [ { // Room Alpha googleCalendarId: calendar-id-room-alpha@group.calendar.google.com , backgroundColor: #8ecae6 }, { // Room Bravo googleCalendarId: calendar-id-room-bravo@group.calendar.google.com , backgroundColor: #219ebc }, { // Room Charlie googleCalendarId: calendar-id-room-charlie@group.calendar.google.com , backgroundColor: #023047 }, { // Room Delta googleCalendarId: calendar-id-room-delta@group.calendar.google.com , backgroundColor: #ffb703 }, { // Room Echo googleCalendarId: calendar-id-room-echo@group.calendar.google.com , backgroundColor: #fb8500 } ], Unfortunately, I don t understand how to provide the events from the Google calendars for the individual rooms. According to the documentation, it should look like this: initialView: resourceTimeGridDay , resources: [ { id: a , title: Room Alpha }, { id: b , title: Room Bravo }, { id: c , title: Room Charlie }, { id: c , title: Room Delta }, { id: d , title: Room Echo } ], So I tried to replace id: with the googleCalendarId:, both the content and the element, but that didn t work. I couldn t find anything else in the documentation. I have not found a useful approach in other ways either. I hope someone here can help me. Thank you very much.
问题回答
Your resource list is fine, but the problem will be that the events themselves don t contain a resource ID when they are fetched from the Google Calendar - because the calendar has no concept of "resources"...instead you ve used different calendars to represent the different rooms. Therefore fullCalendar can t match the event to a specific resource, in order to know where to display it. You can overcome this by adding a per-event-source data transform. The event source documentation notes that you can add an eventDataTransform callback specifically for that source. The eventDataTransform callback allows you to manipulate the data of each event after it s been downloaded from the source, but before it s passed to fullCalendar s rendering functionality. You can use that to add the relevant resource ID to each downloaded event, in order to map the Google Calendar rooms to a fullCalendar resource. For example: initialView: resourceTimeGridDay , resources: [ { id: a , title: Room Alpha }, { id: b , title: Room Bravo }, { id: c , title: Room Charlie }, { id: c , title: Room Delta }, { id: d , title: Room Echo } ], googleCalendarApiKey: api-key , eventSources: [ { // Room Alpha googleCalendarId: calendar-id-room-alpha@group.calendar.google.com , backgroundColor: #8ecae6 , eventDataTransform: function(eventData) { eventData.resourceId = a ; return eventData; } }, { // Room Bravo googleCalendarId: calendar-id-room-bravo@group.calendar.google.com , backgroundColor: #219ebc , eventDataTransform: function(eventData) { eventData.resourceId = b ; return eventData; } }, { // Room Charlie googleCalendarId: calendar-id-room-charlie@group.calendar.google.com , backgroundColor: #023047 , eventDataTransform: function(eventData) { eventData.resourceId = c ; return eventData; } }, { // Room Delta googleCalendarId: calendar-id-room-delta@group.calendar.google.com , backgroundColor: #ffb703 , eventDataTransform: function(eventData) { eventData.resourceId = d ; return eventData; } }, { // Room Echo googleCalendarId: calendar-id-room-echo@group.calendar.google.com , backgroundColor: #fb8500 , eventDataTransform: function(eventData) { eventData.resourceId = e ; return eventData; } } ],




相关问题
Google Calendar embeds - but won t respond

I successfully embedded the Google Calendar IFRAME, however, without any JS error -- it won t respond to any of my clicks, nor display any events. After double checking the calendar settings and ...

CalDav on Outlook? [closed]

I m looking for a good way to view CalDav calendars within Outlook. I m aware of the OpenConnector project, but have not been happy with it thus far (re: stability issues & difficulty to ...

Java and Google Calendar

I would be shocked if this were immediately answered here, as this is a question specific to the Google Calendar Java API, but I ll put it out there anyway. The tutorials for Google Calendar give a ...

google calendar java api

I have an object of CalendarEntry I know that http://www.google.com/calendar/feeds/example@gmail.com/allcalendars/full is the feed url of all calendars but how I can get this feed url from ...

Developing a Firefox extension for Google Calendar

I am actually not so sure if it is possible but It would be great for me to have a firefox add-on to add/remove/edit/delete for google calendar. Is there any blog entry or a reference documents about ...

热门标签