mHo*_*ses 3 javascript jquery fullcalendar
是否可以限制FullCalendar,以便在创建事件拖动时,该事件不会跨越其他日期?
我的意思是:如果我在 3 月 20 日 09:00 开始选择,我希望用户无法选择在 3 月 21 日 13:00 结束的事件。
您可以将eventConstraint添加到日历设置中。
eventConstraint:{
start: '00:00', // a start time (start of the day in this example)
end: '24:00', // an end time (end of the day in this example)
},
Run Code Online (Sandbox Code Playgroud)
您可以在此 plunker 中重现它。
如果您只想在拖动过程中限制它,我认为您只能使用eventDrop 回调来做到这一点。如果moment.startOf('day)不同,您可以使用 revertFunc 将拖放移动恢复到之前的状态。
就像是:
$('#calendar').fullCalendar({
events: [
// events here
],
editable: true,
eventDrop: function(event, delta, revertFunc) {
if (!event.start.startOf('day').isSame(event.end.startOf('day'))) {
revertFunc();
}
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3618 次 |
| 最近记录: |