Our powerful JS Calendar component


Post by Animal »

It can't be defined unless you are in a resourceView in which the view you are dropping in has a resource. Otherwise what would it be?

What are you wanting to do?


Post by sbprot »

When I move an event (via drag-and-drop) on my calendar, I make an API request to update my database with the new information (if the date, time, or the resource assigned to the event has changed).

To do this, I use the dragMoveEnd() method, which triggers once I’ve moved an event. So far, managing the resource wasn’t a problem since the eventRecord object would correctly return the assigned resource after the move. However, since the 6.0 update, eventRecord no longer returns the new resource after the move but the one from before the move (which is not helpful in this case, as I need to update the database with the new event information).

As it’s stated in the documentation (see the screenshot I posted earlier) that the eventRecord in the dragMoveEnd() method returns an "updated EventModel record", I figured it wasn’t normal for it to return the resource that doesn’t match the EventModel after the update, especially since it worked perfectly before.

I found an alternative solution to get the result I was after, using this logic in the dragMoveEnd() method:

let updatedResource = source.eventStore.find((event) => event.data.id === eventRecord.getData('id')).getData('resourceId')

I hope this clarifies things.


Post by Animal »

There will only ever be a resourceRecord in the dragMoveEnd event if you are dragging inside a ResourceView or a DayResourceView you can see below I have dragged an event from Tim Anderson to Jenny Brown.

Screenshot 2024-09-04 at 20.15.22.png
Screenshot 2024-09-04 at 20.15.22.png (1.33 MiB) Viewed 52 times

Dragging in any other type of view can never and has never given you any resource, because there can be no change in resource. There's no resource information to be had.

I cannot tell what your requirement is from that code. I have no context at all.

let updatedResource = source.eventStore.find((event) => event.data.id === eventRecord.getData('id')).getData('resourceId')

Post by sbprot »

Hello,

The mode type of my current view is 'dayresource', and I do have multiple resources displayed on my calendar. The difference is that I have a single calendar displaying, for each day, a column for each resource (unlike your example, which shows a separate calendar for each resource).

Given that, why is resourceRecord undefined, even though there are multiple resources visible on my calendar?

20240916162017.png
20240916162017.png (24.35 KiB) Viewed 27 times

Post by alex.l »

Hi,

Thanks for clarifications! That's a bug, I've opened a ticket here https://github.com/bryntum/support/issues/10070
You can subscribe on ticket updates to be notified when it's done.

All the best,
Alex


Post by sbprot »

Hi alex,

Thanks for the quick response! I’ll follow the ticket and keep an eye on updates. Good luck to the team with the fix!

Have a great day!


Post Reply