Issue 709: eventResize, after posting data via ajax the event reverts automatically
Status:  Done
Owner: ----
Closed:  Feb 2011
Reported by maximsch...@gmail.com, Nov 14, 2010
I used eventDrop and eventResize to post updates to a database via php. 

With the eventDrop, it works and I don't need to refetch any events. But with eventResize, it automatically reverts and I need to use the refetchEvents function to show the updated event.

Here is my code:

eventDrop: function(event,dayDelta,minuteDelta,allDay,revertFunc) {
        		$.post('include/update_booking.php', {id: event.id, dayDelta: dayDelta, minuteDelta: minuteDelta, allDay: allDay, type: 'drop'}, function(jsonObj) {
					var array = eval('(' + jsonObj + ')');
					$('#updateBox').prepend($(array.message).fadeIn('slow'));
					if(array.test == 'multiple'){revertFunc();};
				});		    
			},
			eventResize: function(event,dayDelta,minuteDelta,allDay,revertFunc) {
        		$.post('include/update_booking.php', {id: event.id, dayDelta: dayDelta, minuteDelta: minuteDelta, allDay: allDay, type: 'resize'}, function(jsonObj) {
					var array = eval('(' + jsonObj + ')');
					$('#updateBox').prepend($(array.message).fadeIn('slow'));
					if(array.test == 'multiple'){revertFunc();}
					else {$('#calendar').fullCalendar( 'refetchEvents' );};
				});		    
			},

Strange thing is, if use just the demo of eventResize, found in the documentation, it does seem to show the updated event...

Maybe something to do with the time it needs to post the date to an external php file?

Thanks in advance
Nov 21, 2010
Project Member #1 adamrs...@gmail.com
can't see anything immediately wrong with your code. can you post your code in a way that it can be executed easily? (online link, or zip file with runnable html file). thanks
Status: Reproducing
Nov 21, 2010
Project Member #2 adamrs...@gmail.com
actually, nevermind, i can see what is going on. looks like your update_booking script is not correctly modifying the end time in your database. the subsequent refetchEvents is rendering the old events, wiping out the event that the user resized
Status: Done
Nov 23, 2010
#3 maximsch...@gmail.com
I don't think you fully understand my problem. 
I am using the refetchEvents above just to overcome this problem, with this it works but i need to refetch all events from the database, unlike with eventDrop that just adjusts the event at client side after sending it to the database.

update_booking.php has nothing to do with this problem. It updates the event correctly in the database, because after the refetch, the adjusted event complies with the resize. 

I just want to leave this extra call to the server out so it stays client based.

It is a bit difficult to post the files, because you'll probably need the database.

I hope this is more clear. Thanks
Dec 18, 2010
Project Member #4 adamrs...@gmail.com
i still don't think i understand your problem.

going back to your original post, you said `eventResize` automatically reverts your events, and you were using `refetchEvents` as a workaround. can you try to demonstrate this bug? (forget about your workaround).

since this bug seems client-side, it should be easy demonstrate the bug w/o using databases. unfortunately, if you can't demonstrate the bug to me in a real-life working example that i can play with, i can't help you.
Status: Reproducing
Feb 15, 2011
Project Member #5 adamrs...@gmail.com
(No comment was entered for this change.)
Status: Done
Mar 23, 2011
#6 hur...@gmail.com
Hi,

I'm having the same issue (using v1.4.11).

To reproduce the issue, simply add an ajax call in the eventResize callback. It doesn't matter which url you request and even if the request succeeds or fails.

This issue seems to be triggered when the callback code contains an ajax call, it works ok when no ajax calls are made. Strange...

Best Regards
Oct 5, 2011
#7 giviu...@gmail.com
Hello, 

I have the same issue, I am making an Ajax call on the eventResize, and automatically reverts my events.

I am using 1.5.2

Please let me know if you found a fix instead a work around.

Regards.
Mar 5, 2013
#8 a...@expatjob.net
@maximsch...@gmail.com

remove allDay from your parameter list and the problem is resolved.

Cheers
Apr 14, 2013
#9 trond.er...@gmail.com
Removing allDay from parameterlist solved the issue for me. Thanks a bundle bmazza..@expatjob.net