javascript - Cannot read property 'clone' of undefined - Stack Overflow

admin2025-03-20  11

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.

Share Improve this question edited Aug 13, 2019 at 11:59 Mohit Verma 5,2942 gold badges14 silver badges28 bronze badges asked Dec 7, 2014 at 13:57 David DsrDavid Dsr 3472 gold badges5 silver badges20 bronze badges 3
  • jsfiddle, if you can that would help me to help you :) – Sadik Commented Dec 7, 2014 at 13:59
  • Ok, this is the link jsfiddle/daviddsr/58fsceLd/1 I had never used jsfiddle. The problem is that I'm using Rails and jsFiddle just let me put HTML, CSS and JavaScript so...I don't know if it will help you to much. Maybe if I pass you my repository in GitHUb could help you more – David Dsr Commented Dec 7, 2014 at 19:29
  • Ok, I've already found out how to do it. I've just used this: eventClick: function(calEvent, jsEvent, view) { window.location.replace("/controls/"+calEvent.id+"/edit") – David Dsr Commented Dec 7, 2014 at 21:33
Add a ment  | 

1 Answer 1

Reset to default 1

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/

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1742421767a212981.html

最新回复(0)