I need to listen to onEventMoved, in order to rearrange the order of some labels. This is something as:
- I open a sidebar
- I click on some services and load them.
If i drag and drop some elements, i need to rearrange the sidebar. What can i do?
Answer posted by Dan Letecky [DayPilot] 2 years ago.
The onEventMoved event is fired when all updates are complete, and it’s fine to use it for updating either the calendar/scheduler itself or external elements.
The onEventMoving event is fired in real time during drag-and-drop. You should limit actions to minor updates of external elements. Updating (reloading) the calendar/scheduler component in this context is not possible.
Comment posted by Anonymous 2 years ago.
How can i listen when calendarRef is called?
Comment posted by Dan Letecky [DayPilot] 2 years ago.
I’m not sure if that’s what you mean but since the last release (2023.4.5801), you can also use a new controlRef prop to get a reference directly to the DayPilot.Calendar object.
It accepts a ref or a callback so you can use it to store the reference in a state variable. The useEffect() block will be executed when the calendar value is set.