我需要检测调整大小是从START(左)还是从END(右)开始。
我尝试过这个解决方案,但没有工作FullCalendar: Detect if resize was on Start or on End.
我需要实现此代码。基本上现在它可以工作,如果我从END调整一个事件,但如果我从START更改,则不会,因为我无法检测我是否从START或END更改。
events: [
{ id: '1', resourceId: 'a', start: '2017-09-07T02:00:00', end: '2017-09-07T04:00:00', title: 'Carico su camion', id_eventi_prima: "", id_eventi_dopo: "2,3,4,5,6,7", id_evento_collegato: "2,3,4,5,6,7", backgroundColor: "green" },
{ id: '2', resourceId: 'a', start: '2017-09-07T04:00:00', end: '2017-09-07T13:00:00', title: 'Viaggio', id_eventi_prima: "1", id_eventi_dopo: "3,4,5,6,7", id_evento_collegato: "1,3,4,5,6,7", backgroundColor: "red" },
{ id: '3', resourceId: 'a', start: '2017-09-07T13:00:00', end: '2017-09-07T15:00:00', title: 'Scarico', id_eventi_prima: "1,2", id_eventi_dopo: "4,5,6,7", id_evento_collegato: "1,2,4,5,6,7", backgroundColor: "grey", editable: false },
{ id: '4', resourceId: 'a', start: '2017-09-07T15:00:00', end: '2017-09-07T19:00:00', title: 'Produzione', id_eventi_prima: "1,2,3", id_eventi_dopo: "5,6,7", id_evento_collegato: "1,2,3,5,6,7", backgroundColor: "orange" },
{ id: '5', resourceId: 'a', start: '2017-09-07T19:00:00', end: '2017-09-07T21:00:00', title: 'Pulizia impianto', id_eventi_prima: "1,2,3,4", id_eventi_dopo: "6,7", id_evento_collegato: "1,2,3,4,6,7", backgroundColor: "blue" },
{ id: '6', resourceId: 'a', start: '2017-09-07T21:00:00', end: '2017-09-07T22:00:00', title: 'Smontaggio', id_eventi_prima: "1,2,3,4,5", id_eventi_dopo: "7", id_evento_collegato: "1,2,3,4,5,7", backgroundColor: "green" },
{ id: '7', resourceId: 'a', start: '2017-09-07T22:00:00', end: '2017-09-08T06:00:00', title: 'Ritorno in azienda', id_eventi_prima: "1,2,3,4,5,6", id_eventi_dopo: "", id_evento_collegato: "1,2,3,4,5,6", backgroundColor: "pink" },
{ id: '8', resourceId: 'b', start: '2017-09-07T04:00:00', end: '2017-09-07T06:00:00', title: 'Viaggio', id_eventi_prima: "", id_eventi_dopo: "", id_evento_collegato: "", backgroundColor: "green" }
],
eventDrop: function( event, delta, revertFunc, jsEvent, ui, view ) {
var arrayEventiCollegati = event.id_evento_collegato;
var newResourceId = event.resourceId;
var relatedEvents = $("#calendar").fullCalendar("clientEvents", function(evt) {
for (var i = 0; i < arrayEventiCollegati.length; i++)
{
if (evt.id == arrayEventiCollegati[i]) return true;
}
return false;
});
for (var i = 0; i < relatedEvents.length; i++)
{
relatedEvents[i].resourceId = newResourceId;
relatedEvents[i].start.add(delta);
relatedEvents[i].end.add(delta);
}
$("#calendar").fullCalendar("updateEvents", relatedEvents);
}, //eventDrop
eventResize: function( event, delta, revertFunc, jsEvent, ui, view ) {
var id_eventi_prima = event.id_eventi_prima;
var id_eventi_dopo = event.id_eventi_dopo;
var arrayEventiCollegati = event.id_evento_collegato;
var relatedEvents = $("#calendar").fullCalendar("clientEvents", function(evt) {
for (var i = 0; i < arrayEventiCollegati.length; i++)
{
if ( evt.id == arrayEventiCollegati[i] ) {
return true;
}
}
return false;
});
for (var i = 0; i < relatedEvents.length; i++)
{
for (var k = 0; k < id_eventi_dopo.length; k++) {
if ( relatedEvents[i].id == id_eventi_dopo[k] ) {
relatedEvents[i].start.add(delta);
relatedEvents[i].end.add(delta);
}
}
}
$("#calendar").fullCalendar("updateEvents", relatedEvents);
} //eventResize