javascript 无法读取未定义的属性“克隆”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27343382/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cannot read property 'clone' of undefined
提问by David Dsr
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:
我正在使用 Fullcalendar 并且我正在尝试更新事件。我正在尝试进行 ajax 回调以获得对该事件的定义编辑。路由是 /controls/:id/edit,所以我构建了这个 ajax 回调:
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:
control_controller.rb 的代码是这样的:
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.
我的问题是,当我单击一个事件时,控制台告诉我“未捕获的类型错误:无法读取未定义的属性‘克隆’”。我不知道那是什么意思。我认为我做得对,但它不起作用。谁能帮帮我??先感谢您。
回答by Mohit Verma
Please check the event data . Sourceattribute 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.
您必须确保必须填充 fullcalendar 事件的 required 属性。这是事件对象的必需和可选字段的链接。