【问题标题】:eventDrop full calendar not moving the eventeventDrop 完整日历不移动事件
【发布时间】:2015-11-12 11:18:44
【问题描述】:
eventDrop: function(event, delta, revertFunc) {

    console.log(event.title + " is moved on " + event.start.format());
    var page = '../include/UpdateCalendarEvent.php';
    $("#dialog")
        .data('start', event.start.format())
        .data('title', event.title)
        .dialog({
            resizable: false,
            modal: true,
            height: 250,
            position: ['middle', 20],
            width: 500,
            title: event.start.format(),
            open: function(event, ui) {
                var start = $("#dialog").data('start');
                var title = $("#dialog").data('title');
                $("#dialog").html(title + " is moved on " + start);
            },
            close: function(event, ui) {
                revertFunc();
            },
            buttons: {
                Close: {
                    class: 'calendareventright',
                    text: 'Close',
                    click: function() {
                        revertFunc();
                        $(this).dialog('close');
                    }
                },
                Move: {
                    id: "calendareventadd",
                    class: 'calendareventleft',
                    text: 'Move',
                    click: function() {
                        var eventData;
                        eventData = {
                            id: event.id,
                            sysid: event.sysid,
                            start: event.start.format(),
                            end: event.end.format(),
                            title: event.title,
                            description: event.description,
                            otherinfor: event.otherinformation,
                            page: '../include/UpdateCalendarEvent.php'
                        };
                        console.log(JSON.stringify(eventData));
                        ajaxcall(eventData, page);
                        $(this).dialog('close');
                    }
                }
            }
        });

}

这是我完整日历中的 eventDrop 函数。我将数据发送到 ajax 并更新数据库。更新完美运行。我的问题是当我移动事件时,会出现对话框并要求用户移动事件或关闭。如果用户选择关闭,事件将恢复。如果用户选择移动事件将被更新到这一点是好的。单击移动按钮后,对话框将关闭。但该事件并未移至日期。但是如果页面被重新加载,如果将去它被移动的日期。

场景:

我在 11 月 4 日有事件我将它移到 11 月 5 日(事件现在在 11 月 5 日)出现对话框要求用户移动或关闭。点击move 对话框将关闭 发送ajax 数据库已更新但事件将返回11 月4 日,如果页面重新加载则事件将移至11 月5 日

预期:

我希望在点击移动后,活动将停留在 11 月 5 日

任何想法都值得赞赏。

ADDITIONAL INFO

如果我使用文档中的代码

eventDrop: function(event, delta, revertFunc) {

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

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

},

按预期进行。控制台没有错误

【问题讨论】:

    标签: javascript jquery ajax events fullcalendar


    【解决方案1】:

    你需要先检查两件事

    close: function(event, ui) {
        revertFunc();
    },
    

    还有

    Move: {
        id: "calendareventadd",
        class: 'calendareventleft',
        text: 'Move',
        click: function() {
            var eventData;
            eventData = {
                id: event.id,
                sysid: event.sysid,
                start: event.start.format(),
                end: event.end.format(),
                title: event.title,
                description: event.description,
                otherinfor: event.otherinformation,
                page: '../include/UpdateCalendarEvent.php'
            };
            console.log(JSON.stringify(eventData));
            ajaxcall(eventData, page);
            $(this).dialog('close');
        }
    }
    }
    

    移动事件后,您将调用关闭对话框,并且在关闭对话框中您会看到revertFunc();

    在移动时不关闭或在关闭功能中不恢复

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多