seankenny / fullcalendar

Full-sized drag & drop event calendar (jQuery plugin)
http://arshaw.com/fullcalendar/
MIT License
60 stars 39 forks source link

Impossible to drag events between resources in 2.1 #43

Open jsgoupil opened 9 years ago

jsgoupil commented 9 years ago

I found the problem but I didn't find the best way to fix this yet. Maybe you could have a look? And if you create a unit test with the commit, I would be able to see what has to be done to fix a bug :)

Repro:

resources:[{id:"1", name:"Bob"}, {id:"2", name: "Joe"}],
events: [
        {
          title: "Title 1",
          start: moment(),
          end: moment(moment() + 3600 * 2 * 1000),
          resources: ['1']
        },
]

The bug is in the following method: rangeToSegs: function(rangeStart, rangeEnd, resourceIds) { resourcesIds here is not what is being dragged but contains the original event. So the rangeToSegs basically will not display the drag properly, it will only display the resources where it is originating from.

If we compare to v2.0, you used to check the left position of the mouse event to calculate the delta column. You could do something similar in 2.1, but going up the stack, I can't find any ui event information. The only information I find is here: cellOver: function(cell, date) { which contains the column number. That would be where we would get the info. But that's super far in the stack. So maybe the only way I see is to re-implement segDragMousedown ?

Also, just to keep in mind, I think you would like to keep the functionality of dragging an event present in 2+ resources, they all should move along.

jsgoupil commented 9 years ago

There is a problem with the same method if you set selectable: true The JavaScript will crash.

pawelas commented 9 years ago

yeah it would be great if you will fix it, I prepared whole app but I need this events...