0
我正在使用Fullcalendar。我现在通过拖放来创建活动。我想在一天中双击一下。我正在尝试使用dayRendar函数,但“event.start.format()”未定义。任何人都可以检查我的代码,我错了什么?由于Fullcalender dayRender
dayRender: function(event, element) {
element.bind('dblclick', function(event,element) {
var title = prompt('Event Title:', event.title, { buttons: { Ok: true, Cancel: false} });
if (title){
console.log(event);
event.title = title;
var start = event.start.format("YYYY-MM-DD[T]HH:MM:SS");
$.ajax({
url: '{!!URL::route("saveCalendarEvent")!!}',
data: 'type=new&title='+title+'&startdate='+start+'&zone='+zone,
type: 'POST',
dataType: 'json',
success: function(response){
event.id = response.eventid;
$('#calendar').fullCalendar('updateEvent',event);
},
error: function(e){
alert('Error processing your request: '+e.responseText);
}
});
}
});
}
错误:
Uncaught TypeError: Cannot read property 'format' of undefined
那么我现在应该做什么scottysmalls? –
首先更改功能参数。然后在你的ajax中使用你提示中的标题作为dayRender回调中的标题和'date'。 (类似于var start = date.format(“YYYY-MM-DD [T] HH:MM:SS”); – scottysmalls