FullCalendar-Scheduler Google日历ResourceIDs查询 [英] FullCalendar-Scheduler Google Calendars ResourceIDs Query

查看:248
本文介绍了FullCalendar-Scheduler Google日历ResourceIDs查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

参考: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文件显示该修补程序尚未添加到该文件中.

是否可以为每个Google日历供稿手动分配一个resourceId,以复制 FullCalendar时间轴视图文档?

任何指导将不胜感激.

解决方案

根据第二个GitHub链接中的问题(您的第一个GitHub链接已合并),GitHub - Add ResourceId Parameter to gcal.js (fix supplied)

GitHub - Specify resourceId in Event Source settings

However, checking the gcal.js file reveals the fix has not been added to that file.

Is it possible to manually assign a resourceId to each of the Google Calendar feeds in order to replicate the Resources and Timeline view indicated by the FullCalendar Timeline View documentation?

Any guidance would be greatly appreciated.

解决方案

As per the issue in your second GitHub link (which your first one was merged with), https://github.com/fullcalendar/fullcalendar-scheduler/issues/124, the fix you mentioned is still awaiting testing (as of 11 Mar 2018). So if you're patient it will likely be added to a future release, assuming it passes the tests. In the meantime, here is a potential workaround:

In fullCalendar it's possible to define a separate eventDataTransform for every event source.

Therefore I think you should be able to use this to set a resource ID for each event depending on the Google Calendar it came from:

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;
    } 
  }
]

I'm not able to test this right now but it looks like it should work. Hopefully this will take place before it's rendered on the calendar and needs to belong to a resource.

这篇关于FullCalendar-Scheduler Google日历ResourceIDs查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆