Can't access extendedProperties from Google Calendar Import

≡放荡痞女 提交于 2020-01-06 05:43:09

问题


Day three into my journey to filter my google calendar events by their source, I am now adding extended properties to my events which I will use to sort my events. Problem is, I can not access my extended properties. I followed this FullCalendar Event Object: Non-standard Fields (GCal) and added the below code to my own copy of the google calendar plugin. (The post answer says to include "extendedProperties: extendedProperties" but that would just break the script without having "item." first).

    return {
        id: item.id,
        title: item.summary,
        start: item.start.dateTime || item.start.date,
        end: item.end.dateTime || item.end.date,
        url: url,
        location: item.location,
        description: item.description,
        extendedProperties: item.extendedProperties,
    };

Then in my script I tried every combination of arg.event.extendedProperties.mykey possible, but I still get undefined. I have checked my event and it does in fact have the extended property in google calendar so the issue has somthing to do with my fullcalendar scripts. Greatly appreciate any help!

      document.addEventListener('DOMContentLoaded', function() {
    var calendarEl = document.getElementById('calendar');

    var calendar = new FullCalendar.Calendar(calendarEl, {

        plugins: [ 'interaction', 'dayGrid' , 'googleCalendar'],
        defaultView: 'dayGridMonth',
        contentHeight: 'auto',
        defaultDate: '2019-06-07',
        header: { left: 'prev,next title', center: '', right: '' },
        googleCalendarApiKey: 'AIzaSyCqf1_CE',
        eventSources: [
            {
              googleCalendarId: 'ao3q73fekndar.google.com',
              className: 'blink182',
              color: 'red',
            },
        ], 
        eventClick: function( arg ) {

            arg.jsEvent.preventDefault();
            document.getElementById("val1").innerHTML = arg.event.extendedProperties.mykey;


        }

    });

    calendar.render();
  });

来源:https://stackoverflow.com/questions/56861182/cant-access-extendedproperties-from-google-calendar-import

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!