1

参考:FullCalendar 3.9.0、FullCalendar-Scheduler 1.9.4

谁能确认是否可以按资源对 Google 日历事件进行分组?将 resourceId 参数添加到日历源,如下所示:

    var myCalSrc = {
    id: 1,
    googleCalendarId: '<myCalSrcURL>',
    color: '<myCalSrcColor>',
    className: '<myCalSrc-events>'
};

导致空白显示。位于 demos 目录中的 FullCalendar-Scheduler gcal.html 文件中的以下注释指出:

  /*
  NOTE: unfortunately, Scheduler doesn't know how to associated events from
  Google Calendar with resources, so if you specify a resource list,
  nothing will show up :(  Working on some solutions.
  */

但是,以下线程似乎表明可能已对此进行了修复:

GitHub - 将 ResourceId 参数添加到 gcal.js(提供修复)

GitHub - 在事件源设置中指定 resourceId

但是,检查 gcal.js 文件会发现修复程序尚未添加到该文件中。

是否可以手动将 resourceId 分配给每个 Google 日历提要,以复制FullCalendar 时间线视图文档指示的资源和时间线视图?

任何指导将不胜感激。

4

1 回答 1

1

根据您的第二个 GitHub 链接(与您的第一个链接合并)中的问题https://github.com/fullcalendar/fullcalendar-scheduler/issues/124,您提到的修复仍在等待测试(截至 3 月 11 日2018)。因此,如果您有耐心,假设它通过了测试,它可能会被添加到未来的版本中。与此同时,这里有一个潜在的解决方法:

在 fullCalendar 中,可以为每个事件源定义一个单独的 eventDataTransform。

因此,我认为您应该能够使用它为每个事件设置资源 ID,具体取决于它来自的 Google 日历:

eventSources: [
  { 
    googleCalendarId: 'abc@group.calendar.google.com', 
    color: 'blue',
    eventDataTransform: function(event) {
      event.resourceId = 1;
      return event;
    } 
  }, 
  { 
    googleCalendarId: 'def@group.calendar.google.com', 
    color: 'green', 
    eventDataTransform: function(event) {
      event.resourceId = 2;
      return event;
    } 
  }, 
  { 
    googleCalendarId: 'ghi@group.calendar.google.com', 
    color: 'red' ,
    eventDataTransform: function(event) {
      event.resourceId = 3;
      return event;
    } 
  }
]

我现在无法对此进行测试,但看起来它应该可以工作。希望这将在它呈现在日历上之前发生并且需要属于一个资源。

于 2018-07-05T08:22:06.463 回答