2

I can't seem to get resourceId on eventDrop and drop, im using resourceTimelineMonth and are trying to move them around.

If i try info.resourceId i get "undefined".

editable: true,
droppable: true,
eventResize: function (info) {
    alert("Resize event: " + info.event.id + info.event.title + " end is now " + info.event.end.toISOString());

    if (!confirm("Gem?")) {
        info.revert();
    }

    SetEvent(info);
},
eventDrop: function (info) {

    console.log('resourceId: ' + info.resourceId);
    //alert(info + " Drop event: " + info.event.title + " was dropped on " + info.event.start.toISOString());
    console.log(info.title);
    //SetEvent(info);
},
drop: function (info) {
    // is the "remove after drop" checkbox checked?
    console.log("Drop event: " + info.resourceId);

    //SetEvent(info);
}

Edit

On eventResize and eventDrop you can find the resource id under: info.event._def.resourceIds[0]

On drop you can find it under: info.resource._resource.id

GalAbra
  • 5,048
  • 4
  • 23
  • 42
  • https://fullcalendar.io/docs/eventDrop ...the properties of `info` are listed in that documentation. What makes you think there is a property called `resourceId`? On the other hand I'd expect it's quite likely that the `event` contained within `info` has a resource ID. So `info.event.resourceId` might give you better results. Or alternatively the `oldResource` or `newResource` properties might be of interest to you. Did you look at the docs at all? – ADyson Jun 28 '19 at 15:52
  • P.S. I'm assuming you're using fullCalendar v4 (since you mention "resourceTimeline"). If that's not the case then please say so, because in v3 the signature for eventDrop is different: https://fullcalendar.io/docs/v3/eventDrop. – ADyson Jun 28 '19 at 15:53

2 Answers2

-1

On eventResize and eventDrop you can find the resource id under: info.event._def.resourceIds[0]

On drop you can find it under: info.resource._resource.id

-1

You can also use event.getResources() so that you can get more information about the resource: id, title...

https://fullcalendar.io/docs/Event-getResources

For example:

       eventDrop: function(info) {
                var infoResources = info.event.getResources();                

                var resourceId = infoResources[0]._resource.id;
                var resourceTitle = infoResources[0]._resource.title;
       }
Tom
  • 1,516
  • 1
  • 14
  • 34