FullCalendar v2错误:Uncaught TypeError: Cannot read property &
FullCalendar v2 error: Uncaught TypeError: Cannot read property 'month' of undefined
我在添加事件时使用select回调。以下代码在v1中工作,但我在v2中得到了未捕获的TypeError。当我删除ajax代码没有错误,但当然我需要添加新的事件到数据库。
select: function(start, end, jsEvent, view) {
var title = 'Available';
var eventData;
eventData = {
title: title,
start: start
};
$.ajax({
type : 'POST',
url : 'add-event.php',
data: eventData,
success : function(data){
$('#calendar').fullCalendar('renderEvent', {
id: data.id,
title: data.title,
start: data.start,
start: data.end
}, true);
$('#calendar').fullCalendar('unselect');
},
error : function(XMLHttpRequest, textStatus, errorThrown) {
}
});
},
尝试用format()
格式发送startDate和endDate。
select: function(start, end, jsEvent, view) {
var title = 'Available';
var eventData;
eventData = {
title: title,
start: start
};
$.ajax({
type : 'POST',
url : 'add-event.php',
data: eventData,
success : function(data){
$('#calendar').fullCalendar('renderEvent', {
id: data.id,
title: data.title,
start: data.start.format(),
end: data.end.format()
}, true);
$('#calendar').fullCalendar('unselect');
},
error : function(XMLHttpRequest, textStatus, errorThrown) {
}
});
},
你可以参考Momentjs
请查看事件数据。事件的源属性必须为空或未填充。调用
前SO$("#日历")。fullCalendar("renderEvent"、事件);
您必须确保必须填充fullcalendar事件的所需属性。这里是事件对象的必选字段和可选字段的链接。
http://fullcalendar.io/docs/event_data/Event_Object/两个版本使用的"calendar"脚本不同。
如果您观察到,V1中对php文件的调用是:
get-events?start=1362076200000&end=1364754600000&_=1403859868502
和V2的调用:
get-events.php?start=2014-06-01&end=2014-07-13&_=1403859868502
我遇到了这个问题,并注意到v2似乎在事件对象中设置了一些额外的_start和_end参数。我发现我需要这样做:start = _start.format(),以防止moment试图序列化它。我不确定这是最佳解决方案,但也许它会对您有所帮助。
相关文章:
- 未捕获TypeError: Cannot read property 'geocode'未定义的'
- SailsJs中的错误.TypeError: Cannot read property '的定义
- 未捕获的TypeError: Cannot read property 'top'的定义
- 未捕获的TypeError: Cannot read property '未定义的数据表
- 未捕获的TypeError: Cannot read property 'timing'的定义
- 未捕获的TypeError: Cannot read property 'checked'零
- 未捕获的TypeError: Cannot read property 'top'在引导中单击导航栏时未
- Extjs5 treepanel [Uncaught TypeError: Cannot read property &
- TypeError: Cannot read property 'submit'添加到购物车'
- 添加自定义jquery.验证方法导致Uncaught TypeError: Cannot read property &
- Vue 2和Vue- resource [Cannot read property 'get'未定义的(
- asp:textbox Uncaught TypeError: Cannot read property 'va
- TypeError: Cannot read property 'search' of undefine
- 读取json时出错未捕获类型错误:Cannot read property 'output'的定义
- 未捕获的TypeError: Cannot read property 'current'在选择任何选项
- 未捕获的TypeError: Cannot read property '3'的定义
- jquery-ui.js:12443未捕获的TypeError: Cannot read property 'a
- jquery Uncaught TypeError: Cannot read property 'left
- 未捕获类型错误:Cannot read property 'print'的定义
- TokenInput + Uncaught TypeError: Cannot read property 't