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

﹥>﹥吖頭↗ 提交于 2019-12-30 11:04:51

问题


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 place holder appointment still render as normal.

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


回答1:


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

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




回答2:


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




回答3:


Edit fullcalendar.js and change line 3547 from

var d2 = cellDate(cell);

to

var d2 = cellDate(origcell);



回答4:


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




回答5:


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

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




回答6:


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.



来源:https://stackoverflow.com/questions/4903140/how-to-disable-the-drag-in-fullcalendar-but-keep-the-ability-to-click-on-a-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!