- Home
- Forum
- React - EJ 2
- Events in Parent and children resources
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?
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.
Thanks you
Dear Customer,
You're welcome! Feel free to reach out to us if you need any assistance.
Regards,
Swathi
Great explanation! Debugging these issues is like planning the perfect move in full of strategy to break the board
Dear Customer,
You're welcome! Feel free to reach out to us if you need any assistance.
Regards,
Saritha S.
- 5 Replies
- 5 Participants
-
KB Kelwin Buratto
- Jul 30, 2025 12:14 PM UTC
- Aug 20, 2025 05:26 AM UTC