开发者

How to disable the drag in FullCalendar but keep the ability to click on a time slot and have the "placeholder" appointment still render

How do I disable the draggable feature in the below FullCalendar example? While I do not want the "draggable" functionality, I still want the ability to click on a time slot and have the pl开发者_Go百科ace holder appointment still render as normal.

http://arshaw.com/js/fullcalendar/demos/selectable.html


$('#example').fullCalendar({
    disableDragging: true
});

thanks to https://stackoverflow.com/a/7907576/216084


currently not possible to limit the selection to a single slot but here is the issue for it: http://code.google.com/p/fullcalendar/issues/detail?id=786


Edit fullcalendar.js and change line 3547 from

var d2 = cellDate(cell);

to

var d2 = cellDate(origcell);


it's not necessary to edit fullcalendar script you can do that like this:

selectAllow: function (e) {
    if (e.end.diff(e.start, 'minutes') > 15) {
        return false;
    }
}

It's for {slotDuration: 15} (minutes in my case), suitable for Scheduler plugin v.3


Quick look at the documentation looks like it's just an option to the constructor:

http://arshaw.com/fullcalendar/docs/event_ui/disableDragging/


To remove the ability to select multiple days, I modified the file fullcalendar.js (v1.5.3) at line 5019:

Replace this :

trigger('select', null, startDate, endDate, allDay, ev);

By this :

trigger('select', null, startDate, startDate, allDay, ev);

Works well for me.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜