Json FullCalendar计划程序Google日历资源ID查询
参考:FullCalendar 3.9.0,FullCalendar Scheduler 1.9.4 有人能确认是否可以按资源对Google日历事件进行分组吗?将resourceId参数添加到日历源,如下所示:Json FullCalendar计划程序Google日历资源ID查询,json,fullcalendar,fullcalendar-scheduler,gcal,Json,Fullcalendar,Fullcalendar Scheduler,Gcal,参考:FullCalendar 3.9.0,FullCalendar Scheduler 1.9.4 有人能确认是否可以按资源对Google日历事件进行分组吗?将resourceId参数添加到日历源,如下所示: var myCalSrc = { id: 1, googleCalendarId: '<myCalSrcURL>', color: '<myCalSrcColor>', className: '<myCalSrc-ev
var myCalSrc = {
id: 1,
googleCalendarId: '<myCalSrcURL>',
color: '<myCalSrcColor>',
className: '<myCalSrc-events>'
};
但是,以下线程似乎表明可能已经对此进行了修复:
但是,检查gcal.js文件会发现该修复程序尚未添加到该文件中
是否可以为每个Google日历订阅源手动分配resourceId,以便复制
非常感谢您的指导。根据您的第二个GitHub链接(第一个链接与之合并)中的问题,您提到的修复程序仍在等待测试(截至2018年3月11日)。因此,如果您有耐心,它可能会被添加到未来的版本中,假设它通过了测试。同时,这里有一个潜在的解决办法: 在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;
}
}
]
我现在无法测试这个,但它看起来应该可以工作。希望这将在它在日历上呈现之前发生,并且需要属于一个资源。将代码更改为:
var myCalSrc={id:1,googleCalendarId:'',颜色:'',resourceID:'a'类名:'}
并添加:$(“#calendar”).fullCalendar({…资源:[{id:'1',title:},…,
无法显示任何事件。您好,ADyson,感谢您的解决方案。现在可以正确显示事件了。不过,我注意到,在资源标题之前添加了一个fc图标类(有效地显示为不必要的前置空间)从Agenday视图切换到timelineMonth时。如果我将默认视图设置为timelineMonth,则最初不会添加fc图标类,因此标题显示时在标题前没有不必要的初始空间。这听起来像是一个与时间线视图相关的单独UI问题。如果上面的答案有助于您使用谷歌日历问题,请记住将其标记为已接受-谢谢。我建议您就图标问题提出一个新问题。谢谢,ADyson。可以。
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;
}
}
]