[英]Jquery FullCalendar Extend Start Date or End Date
I am using Jquery FullCalendar. 我正在使用Jquery FullCalendar。
Here is the link of calender I am using : http://arshaw.com/fullcalendar/ 这是我正在使用的日历链接: http : //arshaw.com/fullcalendar/
I have a case where I have startdate and enddate. 我有一个案例,我有开始和结束。
Now if I extend startdate or enddate by dragging it. 现在,如果我通过拖动它来延长startdate或enddate。
How can I get the response event that was triggered when I dragged/extend the date? 如何在拖动/延长日期时获取触发的响应事件?
For Example: 例如:
When I move the event from one date to another I use eventDrop . 当我将事件从一个日期移动到另一个日期时,我使用eventDrop 。 It gives me the days added or subtracted to the original dates.
它给了我添加或减去原始日期的日期。
I need the same solution for extending startdate or enddate. 我需要相同的解决方案来延长startdate或enddate。
Possibilities I am facing: 我面临的可能性:
Original Dates : 2013-12-04 to 2013-12-07 原始日期:2013-12-04至2013-12-07
When Extends : 2013-12-04 to 2013-12-10 延期时间:2013-12-04至2013-12-10
OR 要么
When Extends : 2013-12-01 to 2013-12-07 扩展时间:2013-12-01至2013-12-07
Here are the cases I am facing. 以下是我面临的案例。 How can I track that what event I performed in Calender and what parameters it pass ?
如何跟踪我在日历中执行的事件以及它通过的参数?
You can use eventResize 您可以使用eventResize
below is the example from offical site: 以下是官方网站的示例:
http://arshaw.com/fullcalendar/docs/event_ui/eventResize/ http://arshaw.com/fullcalendar/docs/event_ui/eventResize/
$('#calendar').fullCalendar({
events: [
// events here
],
editable: true,
eventResize: function(event,dayDelta,minuteDelta,revertFunc) {
alert(
"The end date of " + event.title + "has been moved " +
dayDelta + " days and " +
minuteDelta + " minutes."
);
if (!confirm("is this okay?")) {
revertFunc();
}
}
});
Jquery Fullcalender is providing alot of options where you play around wth your events , as per you requirement 根据您的要求,Jquery Fullcalender提供了许多选项,您可以根据自己的活动进行游戏
Original Dates : 2013-12-04 to 2013-12-07
When Extends : 2013-12-04 to 2013-12-10
This is when you extend the event duration, to catch the event where you change the end date you can use the below code 这是当您延长事件持续时间时,捕获更改结束日期的事件,您可以使用以下代码
eventResizeStart: function (event, jsEvent, ui, view) {
console.log('RESIZE START ' + event.title);
},
eventResizeStop: function (event, jsEvent, ui, view) {
console.log('RESIZE STOP ' + event.title);
},
eventResize: function (event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, view) {
console.log('RESIZE!! ' + event.title);
console.log(dayDelta + ' days'); //this will give the number of days you extended the event
console.log(minuteDelta + ' minutes');
},
Original Dates : 2013-12-04 to 2013-12-07
When Extends : 2013-12-01 to 2013-12-07
This is when you pre-pone the event , then you can use the below code 这是您预先设置活动的时间,然后您可以使用以下代码
eventDragStart: function (event, jsEvent, ui, view) {
console.log('DRAG START ' + event.title);
console.log(this);
},
eventDragStop: function (event, jsEvent, ui, view) {
console.log('DRAG STOP ' + event.title);
console.log(this);
},
eventDrop: function (event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui, view) {
console.log('DROP ' + event.title);
console.log(dayDelta + ' days'); //this will give the number of days you dragged before or after
console.log(minuteDelta + ' minutes');
console.log('allday: ' + allDay);
},
As per you comment above that if you want to restrict the user from dragging a event or resizing a event , then you can use eventDurationEditable
, this is true
by default 根据您上面的评论,如果您想限制用户拖动事件或调整事件大小,那么您可以使用
eventDurationEditable
,默认情况下这是true
eventDurationEditable:false,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.