{"action":"created","issue":{"url":"https://api.github.com/repos/fullcalendar/fullcalendar-scheduler/issues/156","repository_url":"https://api.github.com/repos/fullcalendar/fullcalendar-scheduler","labels_url":"https://api.github.com/repos/fullcalendar/fullcalendar-scheduler/issues/156/labels{/name}","comments_url":"https://api.github.com/repos/fullcalendar/fullcalendar-scheduler/issues/156/comments","events_url":"https://api.github.com/repos/fullcalendar/fullcalendar-scheduler/issues/156/events","html_url":"https://github.com/fullcalendar/fullcalendar-scheduler/issues/156","id":147182687,"number":156,"title":"revertFunc misbehaves for events specified with the array form of resourceIds","user":{"login":"kferrio","id":1403507,"avatar_url":"https://avatars.githubusercontent.com/u/1403507?v=3","gravatar_id":"","url":"https://api.github.com/users/kferrio","html_url":"https://github.com/kferrio","followers_url":"https://api.github.com/users/kferrio/followers","following_url":"https://api.github.com/users/kferrio/following{/other_user}","gists_url":"https://api.github.com/users/kferrio/gists{/gist_id}","starred_url":"https://api.github.com/users/kferrio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kferrio/subscriptions","organizations_url":"https://api.github.com/users/kferrio/orgs","repos_url":"https://api.github.com/users/kferrio/repos","events_url":"https://api.github.com/users/kferrio/events{/privacy}","received_events_url":"https://api.github.com/users/kferrio/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-10T01:41:12Z","updated_at":"2016-04-10T06:12:11Z","closed_at":null,"body":"#### UPDATE\r\n**My initial analysis (below) was wrong. The problem has *nothing* to do with where the data are obtained. See elaboration further down in this thread.**\r\n\r\n\r\nI read the rules at http://fullcalendar.io/wiki/Reporting-Bugs/ but I have an observation that occurs only when on pulling data from a JSON source.  I'd rather not stand up a public API to demo this, but maybe one already exists?\r\n\r\nSo... If I start with the example template for scheduler at JSBin *with static data*, everything renders as expected.  And if I add this\r\n```\r\neventDrop: function (event, delta, revertFunc) { revertFunc(); }\r\n```\r\nthen as expected every attempt to move an event is reverted.  All good.\r\n\r\nIf I instead pull the resources and events from an API\r\n```\r\nresources:\r\n            {\r\n                url: '/myapi/resources',\r\n                error: function() {\r\n                    $('#script-warning').text('Failed to load resources').show();\r\n                }\r\n            },\r\nevents:\r\n           {\r\n                url: '/myapi/events',\r\n                error: function() {\r\n                    $('#script-warning').text('Failed to load events').show();\r\n                }\r\n            },\r\n```\r\nall my events load and render as expected.  But then a strange thing happens when I try to move an event. Remember, every move will (should be) reverted. In fact all attempts to move an event horizontally (same resource, different time) are reverted. Good.  But if I try to move any given event vertically (same time, different resource OR different time, different resource) the *resource change is allowed!* The time change is reverted, as expected. Subsequent attempts to move the *same event* (in any direction) are reverted.  In other words, time changes are always disallowed as expected but resource changes are allowed on the first attempt (only) and reverted on all subsequent attempts for the same event.\r\n\r\nTo recap: when fetching events and resources from an API as JSON, the first call to revertFunc() appears to revert the time as expected but incorrectly permits the resource change (if requested).  All subsequent attempts to move the same event -- in any direction -- are rejected, as expected. This behavior is different from the behavior with static data.\r\n\r\nI have not attempted to discern whether the problem is triggered only by pulling resources from an API, only by pulling events from an API, or only by pulling both from APIs.  In any event, my application needs to pull both from an API.\r\n\r\nAlso please note that all of my resource id's and event id's are integers. They do not start at 1 and they are not consecutive, but each is a unique key of course.\r\n\r\nPlease advise. "},"comment":{"url":"https://api.github.com/repos/fullcalendar/fullcalendar-scheduler/issues/comments/207928733","html_url":"https://github.com/fullcalendar/fullcalendar-scheduler/issues/156#issuecomment-207928733","issue_url":"https://api.github.com/repos/fullcalendar/fullcalendar-scheduler/issues/156","id":207928733,"user":{"login":"kferrio","id":1403507,"avatar_url":"https://avatars.githubusercontent.com/u/1403507?v=3","gravatar_id":"","url":"https://api.github.com/users/kferrio","html_url":"https://github.com/kferrio","followers_url":"https://api.github.com/users/kferrio/followers","following_url":"https://api.github.com/users/kferrio/following{/other_user}","gists_url":"https://api.github.com/users/kferrio/gists{/gist_id}","starred_url":"https://api.github.com/users/kferrio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kferrio/subscriptions","organizations_url":"https://api.github.com/users/kferrio/orgs","repos_url":"https://api.github.com/users/kferrio/repos","events_url":"https://api.github.com/users/kferrio/events{/privacy}","received_events_url":"https://api.github.com/users/kferrio/received_events","type":"User","site_admin":false},"created_at":"2016-04-10T06:12:11Z","updated_at":"2016-04-10T06:12:11Z","body":"The actual problem is resourceIds (array) versus resourceId.  \r\nSee  [this JSBin](http://jsbin.com/nenoqu/edit?js,output) for a complete demo.\r\n\r\nAn event for which resource(s) are specified using the array form, with key `resourceIds` is not handled correctly by the `revertFunc` provided to the `eventDrop` handler.  An event specified in this way, regardless of the actual number of resources it references, will have its time but not it's resource(s) reverted one the first attempt to revert a drag-and-drop action. All subsequent attempts to revert a drag-and-drop on the same object will succeed, *viz.* reverting the the requested change works as expected.\r\n\r\nPlease do not be distracted (much) by the fact that dragging an event really makes sense only along the time axis. For simplicity, in the JSBin, focus just on the the two events with one resource each, and ignore the event with two resources. That's another issue.\r\n\r\n"}}