问题
I have integrated full calendar with my Google calendar, I have already disabled on click of each event, because I didn't want to share all the details of an event with others on my website. I just wanted to show when I am busy and when I am free. The problem is that I even want to hide titles of events, and only display the 'location' or 'where' field of a google event. although the response I get includes the location, I don't know how should I get it and display it. Here is my code:
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
events: {
url: 'https://www.google.com/calendar/feeds/a06g3aano640bal6idonn44ves%40group.calendar.google.com/public/basic',
className: 'gcal-event',
color: 'yellow', // an option!
textColor: 'black'
},
eventRender: function (event, element, view) {
if ( event.allDay) {
element.css({'background-color': 'red',
'border':'1px solid red'});
}
},
eventClick: function(event) {
if (event.url) {
return false;
}
},
回答1:
It's not complicated, just check if the location is set inside eventRender
. If it is, show it as title, otherwise show the default text:
var title = ( event.location ) ? event.location : 'Doing something';
element.html(title);
回答2:
Yes, I did it by changing the fullcalendar.js file, where it was set to "title" I changed it to event.location, and it did work :) But now I have another problem, I am still looking into event object, but I cannot find it there. and that's I have to check busy/availability of an event to change the color of that event accordingly. But still didn\t figure it out yet.
来源:https://stackoverflow.com/questions/25558317/integrating-full-calendar-with-google-calendar-adding-where-location-field