[英]How to limit fullcalendar events to only one day?
您可以将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)
},
你可以在这个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();
}
}
});
$('#calendar').fullCalendar({
events: [
{
title : 'event1',
start : '2010-01-01'
},
{
title : 'event2',
start : '2010-01-09T09:30:00',
end : '2010-01-09T15:30:00',
},
{
title : 'event3',
start : '2010-01-09T12:30:00',
allDay : false // will make the time show
}
]
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.