Skip to content
This repository has been archived by the owner on Aug 14, 2020. It is now read-only.

revertFunc does not revert to previous resource. #16

Open
jmarquesh opened this issue Nov 19, 2013 · 4 comments
Open

revertFunc does not revert to previous resource. #16

jmarquesh opened this issue Nov 19, 2013 · 4 comments

Comments

@jmarquesh
Copy link

When dropping an event in a new resource, if you call revertFunc to revert the changes, it will revert only the date and time, not the resource.

@ahmad19
Copy link

ahmad19 commented Mar 13, 2014

@jmarquesh Did you find the solution for it?

@jmarquesh
Copy link
Author

I may have a solution. I will have to check tonight.

@jmarquesh
Copy link
Author

Search for this:

eventElement.draggable({

Inside that object search for this line:

stop: function(ev, ui) {

Inside that function search for this:

// resource changed?

Below that comment modify the existent code to match this:

var oldResourceId;

if (event.resource) {
    oldResourceId = event.resource.id;
    var newColumn = event.resource._col + columnDelta;
    var resources = calendar.getResources();
    event.resource = resources[newColumn];
    event.resource._col = newColumn;
}

eventDrop(this, event, dayDelta, minuteDelta, allDay, ev, ui, oldResourceId);

Search for the function eventDrop, add the oldResourceId parameter:

function eventDrop(e, event, dayDelta, minuteDelta, allDay, ev, ui, oldResourceId)

In the same function call moveEvents sending the oldResourceId:

moveEvents(eventsByID[eventId], -dayDelta, -minuteDelta, oldAllDay, oldResourceId);

Add the oldResourceId parameter to moveEvents:

function moveEvents(events, dayDelta, minuteDelta, allDay, oldResourceId)

Add these lines before the call to normalizeEvents:

if (oldResourceId !== undefined)
  e.resourceId = oldResourceId;

normalizeEvent(e, options);

Write again if you have questions.

@ahmad19
Copy link

ahmad19 commented Mar 14, 2014

Hey i ve tried your code, but it didnt work.
May be we have different versions.
I ve tried this calendar and followed these steps but no luck
http://www.ikelin.com/fullcalendar-resource-day-view-bug/

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants