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

scroll 2 daypilot component in a single scroll event

Asked by Anonymous
1 year ago.

How to handle the scroll for 2 daypilot component in a single scroll event. Both daypilot components should be in sync while scrolling any of the component. headers will be same for both.

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

You can synchronize two Schedulers using a native scroll event as demonstrated in this demo:
https://javascript.daypilot.org/demo/scheduler/eventmovingtwoschedulers.html

// scrollbar synchronization
dp.nav.scroll.addEventListener("scroll", function () {
    dp2.nav.scroll.scrollLeft = dp.nav.scroll.scrollLeft;
});

dp2.nav.scroll.addEventListener("scroll", function () {
    dp.nav.scroll.scrollLeft = dp2.nav.scroll.scrollLeft;
});

The dp and dp2 variables hold DayPilot.Scheduler objects. In Angular, you need to access the objects in ngAfterViewInit or later and you need to cast them to any because the nav property is internal.

In some cases, it might be better to use frozen rows instead of two Schedulers:
https://doc.daypilot.org/scheduler/frozen-rows/

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