Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/431.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 将事件拖到FullCalendar上时防止重叠_Javascript_Jquery_Fullcalendar - Fatal编程技术网

Javascript 将事件拖到FullCalendar上时防止重叠

Javascript 将事件拖到FullCalendar上时防止重叠,javascript,jquery,fullcalendar,Javascript,Jquery,Fullcalendar,我有一些外部事件,只有当数据可共享='true'时,才应该将它们放到FullCalendar上。如果数据可共享='false',则只要该事件不与另一个已删除事件重叠,就可以删除该事件 if (this.getAttribute('data-shareable') == 'true' ) { $('#calendar').fullCalendar('renderEvent', copiedEventObject, true); }else{ alert('this is not a shareab

我有一些外部事件,只有当数据可共享='true'时,才应该将它们放到FullCalendar上。如果数据可共享='false',则只要该事件不与另一个已删除事件重叠,就可以删除该事件

if (this.getAttribute('data-shareable') == 'true' ) {
$('#calendar').fullCalendar('renderEvent', copiedEventObject, true);
}else{
alert('this is not a shareable resource');
}
我创建了这个例子

注意:“事件2”是唯一一个可共享数据的=“false”,因此,如果它与另一个删除的事件重叠,则不应删除它。

if (this.getAttribute('data-shareable') == 'true' ) {
$('#calendar').fullCalendar('renderEvent', copiedEventObject, true);
}else{
alert('this is not a shareable resource');
}
添加了第13-14行以扩展对象,并保存有关数据id和数据共享的信息

            var eventObject = {
            title: $.trim($(this).text()), // use the element's text as the event title
            shareable: $(this).data('shareable'),
            id: $(this).data('id')
        };
现在,您需要更改您的决策逻辑。 您必须检查目标事件和拖动事件是否都可共享,以及一个事件的开始或结束是否介于另一个事件和拖动事件之间

如果它们是可共享的,则无需做更多的事情;如果它们不是,则检查日期

如果日期不重叠,请继续!如果没有,请关闭并记录用户:)