thekingsimo / jquery-week-calendar

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

incorrect behavior by "overlapping = false" #104

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hello first of all i will say that is a very good plugin and i hope your
work will continue.

I found a problem if I set:
    allowCalEventOverlap  : false,
    overlapEventsSeparate : false,

the problem is that an event can't drag & drop in a day column that have an
event. It is indifferent if the two events directly overlapp or I put an
event 2 hours before an another event. The effect is always the same, that
i can't drop that event. I think the overlapping look for an event on this
day and then it find an event, whatever the time overlap or not, it will
return the event.

You can test it with your own Demo (full demo), set "allowCalEventOverlap :
true, overlapEventsSeparate : true" of false and test it.

Original issue reported on code.google.com by ridingwe...@googlemail.com on 19 Nov 2009 at 2:30

GoogleCodeExporter commented 8 years ago
the problem it's in _adjustForEventCollisions:

if (! oldCalEvent.resizable || (newCalEvent.end.getTime() <=
currentCalEvent.end.getTime()
                  && newCalEvent.start.getTime() >= currentCalEvent.start.getTime())) {

               adjustedStart = oldCalEvent.start;
               adjustedEnd = oldCalEvent.end;
               return false;
            }

try to comment the condition !oldCalEvent.resizable.

Original comment by ichigocr...@gmail.com on 19 Nov 2009 at 4:33

GoogleCodeExporter commented 8 years ago
Thanks for the reply.

It works if I replace all the code in the function '_adjustForEventCollisions:'

example:
#####################################################################
_adjustForEventCollisions : function($weekDay, $calEvent, newCalEvent, 
oldCalEvent,
maintainEventDuration) {

        if (! oldCalEvent.resizable || (newCalEvent.end.getTime() <=
currentCalEvent.end.getTime() && newCalEvent.start.getTime() >=
currentCalEvent.start.getTime())) {
               adjustedStart = oldCalEvent.start;
               adjustedEnd = oldCalEvent.end;
               return false;
            }
      },
#####################################################################

but it is the right way to fix the bug?

Original comment by ridingwe...@googlemail.com on 19 Nov 2009 at 4:46

GoogleCodeExporter commented 8 years ago
I think no.
The condition !oldCalEvent.resizable correct another bug. If you debug, you see 
that
the oldCalEvent.resizable is undefined and it take the value false.
oldCalEvent.resizable must value 'true' to fix the bug.

Original comment by ichigocr...@gmail.com on 19 Nov 2009 at 5:03

GoogleCodeExporter commented 8 years ago
This is not good.
I hope it will fixed as soon as possible because i think it is an elementary 
feature
of the calendar and it will be a great pitty if that feature isn't useable.

Original comment by ridingwe...@googlemail.com on 20 Nov 2009 at 1:08

GoogleCodeExporter commented 8 years ago
I replaced 

!oldCalEvent.resizable 

with

oldCalEvent.resizable==false

in 

if (! oldCalEvent.resizable || (newCalEvent.end.getTime() <=
currentCalEvent.end.getTime()
                  && newCalEvent.start.getTime() >= currentCalEvent.start.getTime
())) {

So I assume when oldCalEvent.resizable is undefined, it is true and thus 
resizable. 
As far as I can see, this fixes the bug.

Original comment by koosvdk...@gmail.com on 15 Dec 2009 at 9:07

GoogleCodeExporter commented 8 years ago
I've implemented the change suggested above and it appears to fix the problem.

Original comment by robmo...@gmail.com on 3 Mar 2010 at 5:42

GoogleCodeExporter commented 8 years ago
I have also implemented the change. It works! thanks

Original comment by nadagoes...@gmail.com on 12 May 2010 at 11:01

GoogleCodeExporter commented 8 years ago
I had an overlapping problem of different time intervals in a day. I changed 
resizable property to false, it solved.

Original comment by ercue...@gmail.com on 28 May 2011 at 8:42