拖动滚动在fullcalendar中不起作用

时间:2017-07-15 05:55:03

标签: jquery fullcalendar

在我的应用程序中,我使用fullcalendar进行事件调度。我可以通过拖动它将事件更改为同月(在月视图中)。但我想将事件更改为下个月,同时拖动事件以便我使用

  

dragScroll:true,

但它不起作用。任何人都可以帮我解决这个问题。

以下是我的全日历编码

$('#calendar').fullCalendar({
        selectable: true,
        dragScroll: true,
        selectConstraint: {
            start: $.fullCalendar.moment().subtract(1, 'days'),
            end: $.fullCalendar.moment().startOf('month').add(1, 'month')
        },
        defaultView: 'month',            
        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,agendaWeek,agendaDay,basicDay,basicWeek'                              
        },
        timeFormat: 'H(:mm)t',
        buttonText: { 
            basicDay: 'List Day',
            basicWeek: 'List Week'
        },          
        allDayDefault: false,
        editable: true,

        droppable: true, // this allows things to be dropped onto the calendar
        eventLimit: true, // allow "more" link when too many events
        events: data,
        eventRender: function (event, element) {
            element.attr('href', 'javascript:void(0);');
            element.click(function() {
                $("#startTime").html(moment(event.start).format('h:mm A'));
                $("#endTime").html(moment(event.end).format('h:mm A'));
                $("#eventInfo").html(event.title);
                $("#employee").html(event.employee);
                $("#date").html(moment(event.start).format('MMM Do'));
                $("#price").html(event.price);
                $("#duration").html(event.duration);
                $("#services").html(event.services);
                $("#eventLink").attr('href', 'appointments');
                //$("#services").dialog({ modal: true, title: event.title, width:350});
                $("#eventContent").modal();
            });
        },


        eventConstraint: {
            start: moment().format('YYYY-MM-DD'),
            end: '2100-01-01' // hard coded goodness unfortunately

            //start: moment('YYYY-MM-DD'),
            // start: '2000-01-01',
            // end: '2100-01-01' // hard coded goodness unfortunately
        },

        eventDrop: function(event, delta, revertFunc,date) {
                swal({
                    title: "Are you sure?",
                    text: "To reschedule the "+ event.title +" appointment to "+event.start.format('MMM Do h:mm A'),
                    type: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#DD6B55",
                    confirmButtonText: "Reschedule",
                    closeOnConfirm: false,
                    closeOnCancel: false
                }, function(isConfirm){

                    if (isConfirm) {
                        $.ajax({
                            type: "GET",
                            url: 'reschedule',
                            data: {id:event.id,date:event.start.format()},
                            success: function (result) {
                                if(result==1)
                                {
                                    swal("Success!", "The appointment was rescheduled.", "success");
                                }
                                else
                                {
                                    swal("Failure!", "Failed to reschedule.", "warning");
                                    revertFunc();
                                }
                            }
                        });
                    } else {
                        swal("Cancelled", "Appointment reschedule calcelled", "error");
                        revertFunc();
                    }
                });
        }

    });

0 个答案:

没有答案