Javascript FullCalendar:使用Google日历事件的位置属性
我已经设置了FullCalendar(v3.8.0)从Google日历中提取事件数据,使用qTip2显示事件信息。这个很好用 我现在尝试显示事件的位置属性。遗憾的是,我似乎不知道如何让FullCalendar在活动中保存来自Google Calendar的信息Javascript FullCalendar:使用Google日历事件的位置属性,javascript,jquery,calendar,fullcalendar,google-calendar-api,Javascript,Jquery,Calendar,Fullcalendar,Google Calendar Api,我已经设置了FullCalendar(v3.8.0)从Google日历中提取事件数据,使用qTip2显示事件信息。这个很好用 我现在尝试显示事件的位置属性。遗憾的是,我似乎不知道如何让FullCalendar在活动中保存来自Google Calendar的信息 <head> <meta charset="utf-8"> <title>Test</title> <meta name="description" cont
<head>
<meta charset="utf-8">
<title>Test</title>
<meta name="description" content="Test">
<meta name="author" content="Test">
<link rel='stylesheet' href='fullcalendar/fullcalendar.css' />
<link rel='stylesheet' href='qtip/jquery.qtip.min.css' />
<script src='lib/jquery.min.js'></script>
<script src='qtip/jquery.qtip.min.js'></script>
<script src='lib/moment.js'></script>
<script src='fullcalendar/fullcalendar.js'></script>
<script type='text/javascript' src='fullcalendar/gcal.js'></script>
</head>
<body>
<script type='text/javascript'>
$(document).ready(function() {
$('#calendar').fullCalendar({
googleCalendarApiKey: '<<hidden>>',
events: {
googleCalendarId: '<<hidden>>'
},
header: {
left: 'title',
center: 'listWeek, agendaWeek, month',
right: 'prev,next'
},
weekends: false,
eventRender: function(event, element) {
element.qtip({
content: event.description,
title: event.title,
position: {
my: 'center', //Ecke des Tooltips
at: 'center', //Position auf der Seite (auch Target möchlich)
target: $(window)
},
show: 'click'
});
},
eventClick: function(event) {
if (event.url) {
return false;
}
}
});
});
</script>
<div id='calendar'></div>
</body>
会议上也讨论了这一点,但提供的解决方案似乎已经过时,不再适用。
关于这个话题的每一条线索要么没有答案,要么没有结论性的答案
我可以采取哪些步骤来使用事件位置?在eventRender回调()期间,假设Google在您收到的JSON中为您提供了该字段,您应该能够访问
event.location
。您可以通过插入行console.log(JSON.stringify(event))来检查事件的内容
到eventRender代码中,以记录可用的事件属性
如果数据源提供自定义属性,则FullCalendar很乐意在事件对象上保留这些属性。一旦您获得了这些数据,您可以随意将其插入事件的HTML中
我不知道您试图在过程中的何处向事件标准属性添加内容,但无论如何,这没有意义-它只是预先定义了一个空属性,不会导致它实际填充任何内容。谢谢!我发现了我的错误。。。一切都一直在进行,但大多数活动都没有在谷歌日历中设置位置。当然,我只检查了那些没有位置的,然后认为位置导入不起作用。现在觉得自己很愚蠢…@user9211114不必尴尬,这很容易做到,但最好检查源数据!很高兴你明白了
EventDef.defineStandardProps({
// not automatically assigned (`false`)
_id: false,
id: false,
className: false,
source: false,
// automatically assigned (`true`)
title: true,
url: false,
rendering: true,
constraint: true,
overlap: true,
editable: true,
startEditable: true,
durationEditable: true,
color: true,
backgroundColor: true,
borderColor: true,
textColor: true,
location: true
});