简体   繁体   English

FullCalendar多个事件

[英]FullCalendar multiple events

Im having a bit of a headache :) - Im trying to add multiple event to a calender, which ALMOST works as it should. 我有点头疼:)-我试图向日历添加多个事件,ALMOST可以正常工作。 When adding a new event, the event gets created and rendered to the calendar. 添加新事件时,将创建该事件并将其呈现到日历中。 Then when adding the second event and saving, it creates 2 new events, when it only should create one (the new event) - Any ideas? 然后,在添加第二个事件并保存时,它将创建2个新事件,而仅应创建一个(新事件)-有什么想法吗?

When creating a new event I just pass in a new object: 创建新事件时,我只是传入一个新对象:

newEvent.title = title;
     newEvent.start = started;
     newEvent.end = end,
       newEvent.allDay = false;

     if (title) {
       calendar.fullCalendar('renderEvent', newEvent, true);
     }

     calendar.fullCalendar('unselect');

See a work in progress fiddle here: https://jsfiddle.net/7bo7z3d0/1/ 在这里查看正在进行的小提琴: https : //jsfiddle.net/7bo7z3d0/1/

The .antosubmit on click handler is getting another copy added each time you do a selection. 每次执行选择时,单击处理程序上的.antosubmit都会添加另一个副本。 One (probably not the best) way to stop it is 阻止它的一种(可能不是最好的)方法是

$(".antosubmit").on("click", function() {
    ...
    $('.antoclose').click();
    $(this).off('click'); /* <--- Turn off the click handler! */
    return false;
});

https://jsfiddle.net/7bo7z3d0/2/ https://jsfiddle.net/7bo7z3d0/2/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM