0
我創建了一個名爲myEvent的對象,並使用它將事件動態地呈現給fullCalendar。我的問題是,如何在這種情況下應用eventClick,我已經嘗試了許多不同的方法並進行了大量的研究,但似乎沒有任何有關此方面的信息。如何在動態添加事件到fullCalendar時使用eventClick?
我當前的代碼看起來像這樣....
var myCalendar = $('#calendar');
myCalendar.fullCalendar();
<% for(var i = 0; i < group.meetings.length; i++) { %>
var startDay = '<%= group.meetings[i].startDay%>'.split("/");
console.log(startDay[0]);
var startTime = '<%= group.meetings[i].startTime%>';
var endDay = '<%= group.meetings[i].endDay%>'.split("/");
var endTime = '<%= group.meetings[i].endTime%>';
var startDayFormatted = moment(startDay[2] + "-" + startDay[0] + "-" + startDay[1] + "T" + startTime).toDate().toISOString();
var endedDayFormatted = moment(endDay[2] + "-" + endDay[0] + "-" + endDay[1] + "T" + endTime).toDate().toISOString();
console.log(startDay[0]);
var myEvent = {
title: '<%= group.meetings[i].meetingName%>',
allDay: true,
start: startDayFormatted,
end: endedDayFormatted,
// Need if statement here after we add the completed boolean
<% if(group.meetings[i].final == true) {%>
color: 'blue',
textColor: 'white'
<%} else if(group.meetings[i].final == false) {%>
color: 'yellow',
textColor: 'black'
<%}%>
};
myCalendar.fullCalendar('renderEvent', myEvent, true);
<%}%>
目前您無法添加任何活動? –