Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documenting onDropFromOutside Event Handler for Resource Schedulers #2662

Open
Javo2804 opened this issue Oct 6, 2024 · 2 comments
Open

Comments

@Javo2804
Copy link

Javo2804 commented Oct 6, 2024

Hi everyone!

I've been working with external events in a resource-based calendar and had trouble retrieving the resourceId when dropping an external event using the onDropFromOutside event handler.

I came across this comment by @MALIK-0 in issue #1090 that mentions passing a resource argument, which corresponds to the resourceId. However, this isn't officially documented, which made it difficult to figure out.

Since I couldn't find much information for this use case (external events and resource-based calendar), it would be helpful to include documentation about handling resourceId within onDropFromOutside. I believe this would be beneficial for future users, especially since it’s been challenging (at least for me) to find open-source libraries that support resource scheduling effectively.

Here’s an example of how I managed to get it working:

const onDropFromOutside = useCallback(
  ({ start, end, allDay, resource }) => {
    const event = draggedEvent;
    if (!event) return;

    const newEvent = {
      ...event,
      start,
      end,
      allDay,
      resourceId: resource,
    };

    setEvents((prevEvents) => [...prevEvents, newEvent]);
    setDraggedEvent(null);
  },
  [setEvents, draggedEvent]
);

Thank you very much for the awesome work!! This library has been a lifesaver for my project.

@AyendiSimeon1
Copy link

I want to fix this issue. Can you assign it to me so i can start right away.

@cutterbl
Copy link
Collaborator

@AyendiSimeon1 Just file a PR and I'll look at it.

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

No branches or pull requests

3 participants