0
我一直在使用FullCalendar最近的预订系统。 问题是,无论何时我选择一个时间范围,它都会添加到eventData对象。我想要做的只是选择一个时间范围。FullCalendar不取消选择以前的选择
当我点击$('#btn-reserve')
按钮时,它应该在日历上呈现事件。
发生了什么事情,即使我以前的选择在日历上呈现。我只想呈现我所做的最后一个选择。
这里是我的代码
$('.calendar').fullCalendar({
selectable: true,
select: function(start, end) {
$('#end_time').val(end);
$('#start_time').val(start);
$('#newScheduleModal').modal({
show : true,
backdrop: 'static',
keyboard: false
});
$('#btn-reserve').click(function(){
eventData = {
title: 'Lesson Schedule',
start: start,
end: end
};
$('.calendar').fullCalendar('renderEvent', eventData, true); // stick? = true
$('#newScheduleModal').modal('hide');
});
$('#btn-cancel-reserve').click(function(){
$('.calendar').fullCalendar('unselect');
eventData = {};
})
},
})