I'm using Fullcalendar and I'm trying to update events. I'm trying to make an ajax callback to get def edit of that event. The route would be /controls/:id/edit, so I've built this ajax callback:
eventClick: function(date, jsEvent, view) {
console.log(date.id)
console.log(jsEvent)
console.log(view)
$.ajax({
type: "GET",
url: "/controls/"+date.id+"/edit",
});
$('#calendar').fullCalendar('updateEvent', event);
}
The code of the controls_controller.rb is this:
def edit
if request.xhr?
@control = Control.find(params[:id])
end
end
My problem is that when I click on one event the console tells me "Uncaught TypeError: Cannot read property 'clone' of undefined". I don't know what that means. I think I'm doing it right but it doesn't work. Anyone could help me?? Thank you in advance.
I'm using Fullcalendar and I'm trying to update events. I'm trying to make an ajax callback to get def edit of that event. The route would be /controls/:id/edit, so I've built this ajax callback:
eventClick: function(date, jsEvent, view) {
console.log(date.id)
console.log(jsEvent)
console.log(view)
$.ajax({
type: "GET",
url: "/controls/"+date.id+"/edit",
});
$('#calendar').fullCalendar('updateEvent', event);
}
The code of the controls_controller.rb is this:
def edit
if request.xhr?
@control = Control.find(params[:id])
end
end
My problem is that when I click on one event the console tells me "Uncaught TypeError: Cannot read property 'clone' of undefined". I don't know what that means. I think I'm doing it right but it doesn't work. Anyone could help me?? Thank you in advance.
Please check the event data . Source attribute of your event must be null or not populated. SO before calling
$('#calendar').fullCalendar('updateEvent', event);
You have to be make sure that required attribute of your fullcalendar event must be populated. Here is the link for required and optional fieldfor event object.
http://fullcalendar.io/docs/event_data/Event_Object/