答案 0 :(得分:1)
我没有触发eventClick
处理程序,而是使用了updateEvent
fullCalendar方法:
var eventsToBeUpdated = [];
var allEvents = $('#calendar').fullCalendar('clientEvents');
var chosenEvents = $('#calendar').fullCalendar('clientEvents', eventId);
// remove selected-event css from all events
for (var ei in allEvents) {
var e = allEvents[ei];
var classIndex;
if (classIndex = e.className.indexOf("selected-event") != -1) {
e.className.splice(classIndex, 1);
eventsToBeUpdated.push(e);
}
}
if (chosenEvents.length > 0) {
chosenEvents[0].className.push("selected-event")
eventsToBeUpdated.push(chosenEvents[0]);
}
// update all events which have changed
for (uei in eventsToBeUpdated) {
var updatedEvent = eventsToBeUpdated[uei];
$("#calendar").fullCalendar("updateEvent", updatedEvent);
}
答案 1 :(得分:0)
好的,不确定你想要做什么。
您可以在fullcalendar声明中定义eventClick :. calEvent参数包含Event Object中的ID。那么你可以添加一个新函数,然后调用相同的函数从你的< DD ID =“1”>传递ID。匹配事件点击?
$('#calendar').fullCalendar({
header: {
left: 'prev, next today',
center: 'title',
right: 'month, basicWeek, basicDay'
}
eventClick: function(calEvent, jsEvent, view) {
alert('Event: ' + calEvent.title);
alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);
alert('View: ' + view.name);
// change the border color just for fun
$(this).css('border-color', 'red');
eClick(calEvent.id);
}
});
function eventClick(id) {
alert('Event ID: ' + id);
' Your event click code would go here.
}
答案 2 :(得分:0)
试试这个:
$("#summary dd").click(function() {
var eventId = $(this).attr('id');
var events = $('#calendar').fullCalendar('clientEvents',eventId);
if (events.length > 0) {
$("#calendar").fullCalendar.trigger('eventClick', events[0]);
}
});