llCalendar中的外部元素获取drop和eventDrop

llCalendar中的外部元素获取drop和eventDrop

本文介绍了如何使用FullCalendar中的外部元素获取drop和eventDrop结束时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想知道我怎样才能得到结束时间,因为当我是console.log(事件),然后结束时间为空,所以它应该返回我一些结束时间,每当我放弃任何事件在星期日期。

I just wanted to know how can i get the end time as when I am console.log(event) then end time comes as null so it should return me some end time whenever I drop any event on week calendar time.

那么如何在外部元素的下降时间结束时,或者即使从一列移动到另一列将调用eventDrop的时间我也想结束时间。

So how to get end time on drop of external element or even when move from one column to another column which will invoke eventDrop and at that time I also want end time.

请不要编辑我的小提琴,并尽可能创建新的小提琴并发给我,这样我就可以看起来像我花了很多时间的时间昨天找出来,但无法找到任何工作的解决方案。

Please don't edit my fiddle and create new one if possible and send it to me so that I can have a look as I spent lot of time yesterday to find out it but couldn't find any working solution on this.

先谢谢你,这里是链接:

Thank you in advance and here is the link:

jsfiddle.net/jimil/8hqe3wxd/3/


推荐答案

如果外部事件没有,那么。在你的小提琴中,defaultTimedEventDuration被使用,因为allDay没有被设置为true。您可以通过

If the external event does not have event data associated, then the defaultTimedEventDuration or defaultAllDayEventDuration will be used. In your fiddle, the defaultTimedEventDuration is being used since allDay is not set to true for the event. You can get the default value by

var defaultDuration = $('#calendar').fullCalendar('option', 'defaultTimedEventDuration');
defaultDuration = moment.duration(defaultDuration); // to add to date need to convert to a moment duration

eventDrop的一个示例

An example for eventDrop

        eventDrop: function(event, delta, revertFunc) {
            //inner column movement drop so get start and call the ajax function......
            console.log(event.start.format());
            console.log(event.id);
            var defaultDuration = moment.duration($('#calendar').fullCalendar('option', 'defaultTimedEventDuration')); // get the default and convert it to proper type
            var end = event.end || event.start.clone().add(defaultDuration); // If there is no end, compute it
            console.log('end is ' + end.format());

            //alert(event.title + " was dropped on " + event.start.format());

        },

放置事件:

For drop event:

drop: function(date) {

            //Call when you drop any red/green/blue class to the week table.....first time runs only.....
            console.log("dropped");
            console.log(date.format());
            console.log(this.id);
            var defaultDuration = moment.duration($('#calendar').fullCalendar('option', 'defaultTimedEventDuration'));
            var end = date.clone().add(defaultDuration); // on drop we only have date given to us
            console.log('end is ' + end.format());
        }

另一个选择是使用选项,如果没有指定,则会导致结束日期设置。

Another option is to use the forceEventDuration option, which will cause an end date to get set if none is specified.

这篇关于如何使用FullCalendar中的外部元素获取drop和eventDrop结束时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 00:47