thekingsimo / jquery-week-calendar

Automatically exported from code.google.com/p/jquery-week-calendar
0 stars 0 forks source link

Allow the rejection of resize and drop events #26

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
When a calendar event is dropped or resized it should be possible to reject
the action in which case the event should be reverted back to it's original
position. 

Consider whether it's possible to indicate visually during a drag whether a
drop is possible. This may be  difficult given that a drop zone is an
entire day so it may not be possible using jquery ui functionality directly.

Original issue reported on code.google.com by robmo...@gmail.com on 17 Jun 2009 at 12:54

GoogleCodeExporter commented 8 years ago
I think this would be a good feature.  In the mean time, I have created a 
workaround
for both dropping and resizing objects in version 1.2.0 which might be of some 
use.

// Prevents an event from being dropped to a slot in the past
eventDrop : function(calEvent, $event) {
    if(calEvent.id) {
        if(calEvent.end.getTime() < new Date().getTime()) {
            $("#calendar").weekCalendar("removeEvent", calEvent.id);
            $("#calendar").weekCalendar("updateEvent", $event);
        }
    }
}

// This rejects a resize after it has been performed, it simply reverts it to 
its
previous position
eventResize : function(calEvent, $event) {
    $("#calendar").weekCalendar("updateEvent", $event);
}

Hope it helps someone.

Original comment by kwakwave...@gmail.com on 4 Aug 2009 at 10:15