Reputation: 1757
I am attempting to set up a FullCalendar application that enables updates to newly-created calendar events. I found a demo on Codepen that uses the eventClick callback to facilitate this. However, I don't understand why the jsEvent parameter is included in the function header, when it doesn't look like it is actually used inside this callback. Is it necessary to write out jsEvent in:
eventClick: function(calEvent, jsEvent) {...}
or can jsEvent just be taken out? Here is the code:
$(document).ready(function() {
$("#calendar").fullCalendar({
header: {
left: "prev,next today",
center: "title",
right: "month,agendaWeek,agendaDay"
},
defaultView: "month",
navLinks: true, // can click day/week names to navigate views
selectable: true,
selectHelper: false,
editable: true,
eventLimit: true, // allow "more" link when too many events
select: function(start, end) {
var title = prompt("Event Content:");
var eventData;
if (title) {
eventData = {
title: title,
start: start,
end: end
};
$("#calendar").fullCalendar("renderEvent", eventData, true); // stick? = true
}
$("#calendar").fullCalendar("unselect");
},
eventRender: function(event, element) {
element
.find(".fc-content")
.prepend("<span class='closeon material-icons'></span>");
element.find(".closeon").on("click", function() {
$("#calendar").fullCalendar("removeEvents", event._id);
});
},
eventClick: function(calEvent, jsEvent) {
var title = prompt("Edit Event Content:", calEvent.title);
calEvent.title = title;
$("#calendar").fullCalendar("updateEvent", calEvent);
}
});
});
Upvotes: 1
Views: 1335
Reputation: 228152
Here's the documentation: https://fullcalendar.io/docs/eventClick
event
is an Event Object that holds the event’s information (date, title, etc).
jsEvent
holds the jQuery event with low-level information such as click coordinates.
If you don't need access to the jQuery event in your eventClick
, you can remove it.
eventClick: function(calEvent) { ... }
Upvotes: 2