| Issue 84: | Canceling or undoing a moved event after eventDrop | |
| 1 person starred this issue and may be notified of changes. | Back to list |
What steps will reproduce the problem? 1.after eventDrop 2. 3. What is the expected output? What do you see instead? Being able to cancel the drop and move event back to original day What version of the product are you using? On what operating system? Latest version on Win XP Pro Please provide any additional information below. After an event has been moved and dropped i do a server call to save the event if there is a validation issue on the new date i want to be able to cancel the drop. Right now i have no way of canceling it. I tried to return false but that did not work. Is there a way to cancel or undo a moved event after eventDrop?
Aug 30, 2009
#1
rmalk...@gmail.com
Aug 30, 2009
Dear Heirem, My silence hasn't been due to any disrespect towards you or your efforts to help fullcalendar. I have just gone through the list of open issues and responded to as many as possible. while doing so, i noticed how often you participate and help others, i am sorry this has gone unnoticed, i genuinely appreciate your help and your interest in this project. you have helped me out a lot w/ support for fullcalendar. The the main reason i have been so quite recently is that ive had less free time. i have just completed a move to a new city and have been working full time (for the first time in my life) so its been a challenge finding time to work on OS. Also, in my attempt to get 1.3 out, i have done a lot of refactoring to accommodate the idea of different 'views' (week, day, etc). maybe too much refactoring. i am just now seeing the light at the end of the tunnel, and there will be a release at the end of this week. i admit, i have spent too much time coding in silence recently, and not enough time responding to issues. As for the thread i deleted, i did so b/c it was a repeat thread (for week view). i SHOULD have posted a reference to the main thread (https://code.google.com/p/fullcalendar/issues/detail?id=2), and just closed it instead of deleting it, i am sorry :( i see you are maintainer of WP Events Calendar. as fullcalendar grows, i was really hoping to incorporate it into a wordpress plugin. we should talk about this. i'll be in touch at adamrshaw aatt gmail. thanks Heirem!
Aug 30, 2009
kunle4 + Heirem,
this issues is something that is very important, for the reasons you point out
(network/ajax failing). i really want to get this incorporated into fc. i sort of have
my hands full finishing up 1.3, but i will try my best to get it in there. lets talk
about the semantics of this. does something like this look appropriate?
eventDrop: function(event, delta) {
$.ajax({
// ...
error: function() {
$('#calendar').fullCalendar('revertEvent', event);
}
});
}
Status:
Accepted
Aug 30, 2009
heirem, if i may ask, what was your solution?
Aug 31, 2009
Dear Adam,
I have a deep respect for you, even I dont know you, because I really like your
coding style and I learned so much just by analyzing the code of FullCalendar. So I
really can not blame you ;o)
Your reasons are very understandable and I would be churlish to judge. I just hope
that your life goes as you wish.
Regarding FullCalendar and Wordpress, I think I have completed the integration of
your nice plugin in Events-Calendar, as the calendar of the administrator. This gives
me a more than satisfactory result. I would be delighted to share this experience and
discuss these topics with you.
About the cancelable drop, I tried to find a solution which preserves and respects
the structure of FullCalendar, while managing to meet my own specifications.
Some explanations are needed.
In Events-Calendar, conditions of treatment of an event, or a recurring event, depend
on both the event properties and the general options. The behavioral results are
obtained, on one side, by the treatment of events and their supply in JSON, and
another side, by inward options FullCalendar, as eventRender, eventDrop etc. ...
In my case the cancellation of the drop depends on several factors. For this reason,
the most flexible solution was to create a boolean property 'revert' associated to an
event. This property is provided natively by JSON: 'event.revert'. And can be
modified in the functions eventRender, eventClick etc.
The changes that I allowed myself to perform in Fullcalendar are these:
1- In the function draggableEvent(event, element), all the calls to eventDrag change
to : eventDrag(this, ev, ui, event.revert);
2- Also in the same function draggableEvent, after 'stop: function(ev, ui)' the
begining is : if (event.revert === true || (!dragTD || dragTD == dragStartTD)) { ...
3- And finally the function eventDrag becomes:
function eventDrag(node, ev, ui, evr) {
var oldTD = dragTD;
dragTD = dayTD(ev.pageX, ev.pageY);
if (!dragStartTD) dragStartTD = dragTD;
if (dragTD != oldTD) {
if (evr != true && dragTD) {
$(node).draggable('option', 'revert', dragTD==dragStartTD);
dayOverlay.css({
top: currTDY,
left: currTDX,
width: currTDW,
height: currTDH,
display: 'block'
});
}else{
$(node).draggable('option', 'revert', true);
dayOverlay.hide();
}
}
}
For security, my function eventDrop start like that:
eventDrop:function(event, delta, jsEvent, ui) {
if(event.revert === true) return;
...
But I imagine, without tried, that the manage of event.revert can have an action on
the drop ...
I hope these explanations are quite clear and it will be useful.
Of course any questions are welcome.
Best regards
Heirem
Sep 8, 2009
Heirem,
Thank you, your explanation is quite clear, i see whats going on. My underlying
implementation will be similar, but i'm going to find a way to make the interface like
this:
eventDrop: function(event, dayDelta, revertFunc, ev, ui) {
// if you want to revert, call this...
revertFunc();
}
we'll see what happens. however, i wont get to this until 1.3 is out. its taking longer
than i expected w/ all the testing and docs changes, but ill get there soon enough.
thanks a lot,
adam
Sep 13, 2009
Thanks Adam and Heirem, I appreciate your responses and I look forward to your solution. I am currently using Adam's FullCalendar and a jquery based weekcalendar to implement event scheduling on salesforce. These two calendars work perfect for me because different users work on the month view than the week view. I have rolled the drag and drop functionality into a "nice to have phase" for my client and its not something i have to do till early October, so I hope by then 1.3 is ready. Thanks Kunle
Sep 21, 2009
hello everyone! i just released 1.3, which has this functionality. look at the new docs for eventDrop and eventResize (http://arshaw.com/fullcalendar/docs/triggered-actions.php). You will see that there is a 'revertFunc' parameter that you can call, which will do this. this will revert an event back to its original state, but you might also need something else... a way to prevent the user from editing events while waiting for an event to save via ajax. opened up a new thread for this: https://code.google.com/p/fullcalendar/issues/detail?id=100
Status:
Fixed
Nov 20, 2009
Hi, it seems not to work in 1.4, please have you a solution for my problem : I'm using fullcalendar to organize an agenda and some events can't be dragged over some limits that Ive defined in the json array returned by php when the div is dropped. So if end+delta > limit_end the event must go to his original position. Thanks for your great work
Aug 13, 2013
(No comment was entered for this change.)
Status:
Implemented
Aug 13, 2013
(No comment was entered for this change.)
Status:
Released
|
|
| ► Sign in to add a comment |