fullcalendar jQuery - 可以从Google日历事件中检索描述吗?

时间:2011-04-27 22:22:39

标签: jquery html fullcalendar google-calendar-api

我已经设置了fullcalendar来加载一些谷歌日历活动但是想知道是否有任何方法可以加载描述或其他数据而不是标题和时间?

我想抓住谷歌日历事件中的'描述'和'where'字段,并在fullcalendar的工具提示中显示它们。

我正在考虑尝试解析event.url结果,但由于跨域ajax请求它不起作用。我想通过代理php脚本或crossframe jquery事情可能有可能,但我想知道fullcalendar是否能更干净地提供对这些数据的任何访问? (或者,如果有人有更好的主意)

enter image description here

3 个答案:

答案 0 :(得分:4)

不知道他们有这个:有趣的发现。 如果查看gcal.js源文件,会出现如下代码块:

events.push({
                        id: entry['gCal$uid']['value'],
                        title: entry['title']['$t'],
                        url: url,
                        start: start,
                        end: end,
                        allDay: allDay,
                        location: entry['gd$where'][0]['valueString'],
                        description: entry['content']['$t']
                    });

我的期望是您可以使用locationdescription字段来执行您想要的操作。

实际上,你可以在条目对象中添加你想要的任何其他字段:你需要知道你有哪些选项,但是http://code.google.com/apis/gdata/samples/cal_sample.html使得它非常简单。我很好奇为什么他们不只是将整个条目对象添加为一个字段,这样就可以在需要的时候访问所有数据。

答案 1 :(得分:0)

在忽略了为什么之后,从Google日历事件中添加说明非常简单,我终于在fullcalendar.js中找到了放置字段的位置。 在第3982行,我改变了

"<div class='fc-event-title col'>" + htmlEscape(event.title || '') +

 "<div class='fc-event-title col'>" + '<strong>' +
   htmlEscape(event.title || '') + '</strong><br>' +
   htmlEscape(event.description || '') +

和繁荣,描述显示了一点造型。 是的,这很简单,我希望这可以帮助那些人。

答案 2 :(得分:0)

在最近的版本中,您可以这样添加:

$('#calendar').fullCalendar({
                eventRender: function(event, element) {
                    element.description = event.description;
                },

现在,在eventMouseover或eventClick中,您可以访问event.description。

我希望这可以提供帮助。