我可以预防冲突时间的事件吗? [英] Can I prevent events with conflict time?

查看:73
本文介绍了我可以预防冲突时间的事件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何防止冲突时间的事件?是否有任何变量可以设置?

How can I prevent events with conflict time? Is there any variable to set up?

推荐答案

不,没有设置变量,但可以使用<一个用于检索fullcalendar在内存中具有的事件的客户端事件。您可以使用 eventDrop 中的以下功能。在下面的例子中,它使用一个函数来过滤事件是否有重叠。

No, there is not a variable to set, but you can use something like clientEvents which retrieves events that fullcalendar has in memory. You can use the function below in the eventDrop. In the case below it uses a function to filter out whether the event will have have an overlap or not.

function checkOverlap(event) {  

    var start = new Date(event.start);
    var end = new Date(event.end);

    var overlap = $('#calendar').fullCalendar('clientEvents', function(ev) {
        if( ev == event)
            return false;
        var estart = new Date(ev.start);
        var eend = new Date(ev.end);

        return (Math.round(estart)/1000 < Math.round(end)/1000 && Math.round(eend) > Math.round(start));
    });

    if (overlap.length){  
            //either move this event to available timeslot or remove it
       }                  
  }

这篇关于我可以预防冲突时间的事件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆