Events in Parent and children resources

Hi!

The component is amazing, thank you! 

I have an event management use case, where I have resources that have children, the difference is that the parent can have events too, my idea is that when there is an event in a parent resource, all children have that event too, and when I have it in a child, the parent has it too, what is the best practice for this use case?


5 Replies

SS Saritha Sankar Syncfusion Team July 31, 2025 09:43 AM UTC

Hi Kelwin Buratto,


Currently, the EJ2 Scheduler does not support directly creating events on a resource and automatically syncing them with its related parent or child resources. However, the possible functionality can be implemented with a combination of event handlers:


1.On event creation in a child resource: Use the popupClose event to programmatically add the same event to the parent resource.


 

 const onPopupClose = (args) => {

        if (args && args.type === 'Editor' && args.data) {

            let eventData = {

            Subject: args.data.Subject,

            StartTime: args.data.StartTime,

            EndTime: args.data.EndTime,

            IsAllDay: args.data.IsAllDay || false,

            Description: args.data.Description,

            ProjectId: args.data.ProjectId,

            TaskId: null,

            };

            scheduleObj.current.addEvent(eventData, 'Save');

        }

            

    };



2.On drag-and-drop of a child event to a parent resource: Use the dragStop event to render the event across all associated child resources.



 

  const onDragStop = (args) => {

        if (args.target && args.target.classList.contains("e-resource-group-cells")) {

          const projectId = args.data.ProjectId;

      

          const relatedTasks = categoryData

            .filter(task => task.groupId === projectId)

            .map(task => task.id); 

      

          const eventData = {

            Subject: args.data.Subject,

            StartTime: args.data.StartTime,

            EndTime: args.data.EndTime,

            IsAllDay: args.data.IsAllDay || false,

            Description: args.data.Description,

            ProjectId: projectId,

            TaskId: relatedTasks,

          };

          scheduleObj.current.addEvent(eventData, 'Save');

        }

    };


Sample Link: https://stackblitz.com/edit/react-n89hwitb-d7s9sqmp?file=index.js


Please let us know if you need any further assistance.



Regards,

Saritha S.



CJ Clone12 job August 14, 2025 05:05 PM UTC

Thanks you



SR Swathi Ravi Syncfusion Team August 15, 2025 03:53 AM UTC

Dear Customer,

You're welcome! Feel free to reach out to us if you need any assistance.

Regards,
Swathi



JO jobclone32 August 20, 2025 03:09 AM UTC

Great explanation! Debugging these issues is like planning the perfect move in full of strategy to break the board



SS Saritha Sankar Syncfusion Team August 20, 2025 05:26 AM UTC

Dear Customer,

You're welcome! Feel free to reach out to us if you need any assistance.

Regards,
Saritha S.


Loader.
Up arrow icon