Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/471.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.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
通过拖放fullcalendar-Javascript更新事件_Javascript_Jquery_Fullcalendar - Fatal编程技术网

通过拖放fullcalendar-Javascript更新事件

通过拖放fullcalendar-Javascript更新事件,javascript,jquery,fullcalendar,Javascript,Jquery,Fullcalendar,我正在为一个我正在开发的项目使用。。。我只剩下一个功能需要实现,那就是将现有事件从其原始位置拖到另一个时间或日期。我想知道如何获取当前对象信息(标题、新开始时间、旧开始时间、id、url等),以便使用更新的信息更新数据库。。。我应该使用Fullcalendar对象中的哪个属性? 我实现了drop属性 drop : function(date, allDay) { // retrieve the dropped element's stored event obj

我正在为一个我正在开发的项目使用。。。我只剩下一个功能需要实现,那就是将现有事件从其原始位置拖到另一个时间或日期。我想知道如何获取当前对象信息(标题、新开始时间、旧开始时间、id、url等),以便使用更新的信息更新数据库。。。我应该使用Fullcalendar对象中的哪个属性? 我实现了
drop
属性

    drop  : function(date, allDay) {
            // retrieve the dropped element's stored event object
            var originalEventObject = $(this).data('eventObject');
            // we need to copy it, so that multiple events don't 
            // have a reference object
            var copiedEventObject   = $.extend({}, originalEventObject);
            // assign it the date that was reported
            copiedEventObject.start = date;
            copiedEventObject.allDay = allDay;

            // render the event on the calendar
            // the last `true` argument determines if the event `sticks`
            $('#calendar').fullCalendar('renderEvent', copiedEventObject, true);

            // if the 'remove after drop' checkbox checked?
            if ($('#drop-remove').is(':checked')) {
                // if so remove the element from the "Draggable Events"
                $(this).remove();
            }
    },

但这不是我想要的

查看事件拖动和调整大小

我想您正在寻找的是eventDrop回调

当拖动停止且事件已移动到其他位置时触发 天/时间

来自arshaw网站的示例:

$('#calendar').fullCalendar({
    events: [
        // events here
    ],
    editable: true,
    eventDrop: function(event,dayDelta,minuteDelta,allDay,revertFunc) {

        alert(
            event.title + " was moved " +
            dayDelta + " days and " +
            minuteDelta + " minutes."
        );

        if (allDay) {
            alert("Event is now all-day");
        }else{
            alert("Event has a time-of-day");
        }

        if (!confirm("Are you sure about this change?")) {
            revertFunc();
        }

    }
});

嘿,我认为在将外部事件拖到日历上时不会调用eventDrop()。而是使用drop()函数。在我的例子中,外部事件会显示在日历中(在资源视图中),但它不会显示在日历中,但当我更改月视图和周视图时,会显示相同的外部事件。因此,我对如何在ResourceView上实现同样的功能感到困惑。有趣的@AffanPathan,你能在这里添加一个问题吗?我已经错过了resources[]属性,一旦我修复了它,现在它可以正常工作了。:)