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

position selected event on the center of view port when zoom in/out

Asked by Suman
10 days ago.

Hi,
I would like to have a feature that when a event is selected and zoom is applied, that event would be positioned to the center of the scheduler view port.

Thanks
Suman

Answer posted by Dan Letecky [DayPilot]
9 days ago.

You can scroll to a specified position using scrollTo() method:
https://api.daypilot.org/daypilot-scheduler-scrollto/

You can get the selected event using multiselect.events():
https://api.daypilot.org/daypilot-scheduler-multiselect-events/

var event = dp.multiselect.events()[0];
if (event) {
  var mid = event.start().addTime((event.end().getTime() - event.start().getTime())/2);
  dp.scrollTo(mid, "fast", "middle");
}
New Reply
This reply is
Your name (optional):