search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

I need to add an event listener on collapse name.

Asked by leigh
1 year ago.

Currently the collapse of the a row in the schedule is triggered by clicking the icon. But I would like trigger the collapse or expand, by clicking the name next to the icon. I have written code to achieve this, however; the Event listener is not added to the DOM node. I have tried add code after the api call and tried to use hooks like: 'onAfterEventRender' and 'onAfterRender' to no avail. The code works when I run it in the browser but only works once. Any advice?

Answer posted by Dan Letecky [DayPilot]
1 year ago.

Adding event listeners to Scheduler elements using global selectors is not a supported scenario. The Scheduler needs to update individual elements as needed.

Instead, use the provided render event handlers (e.g. onBeforeRowHeaderRender) to provide the functionality.

You can handle the row click using onRowClick event:
https://api.daypilot.org/daypilot-scheduler-onrowclick/

Please see also my answer here:
https://forums.daypilot.org/question/5833/trigger-collapseall-and-expandall-on-clicking-header

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.