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

onScroll infinite loop

Asked by Ruud
3 years ago.

Hi,

I am using the angular scheduler control. this is a piece of my config:

onRowFilter: this.onRowFilter.bind(this),
infiniteScrollingEnabled: true,
infiniteScrollingMargin: 20,
infiniteScrollingStepDays: 93,
dynamicLoading: true,
onScroll: (args) => {
   args.async = true;
   let start = args.viewport.start;
   let end = args.viewport.end;
  
   this.eventService.getEvents(start, end).subscribe((result) => {
      args.events = result;
      args.loaded();
   });
}

It seems that when the events are set and the args.loaded() is called, onScroll is triggered again. This keeps looping. Is there anything wrong with my config?

Thank you for any information you can give me.

Comment posted by Ruud
3 years ago.

it seems that setting args.clearEvents= false; fixes the reload (loop) issue. And i now see my events again.
Could it be that this is a bug?

Answer posted by Dan Letecky [DayPilot]
3 years ago.

Unfortunately, I'm not able to reproduce the problem with args.clearEvents = true. Which version of DayPilot do you use?

In Angular, it's necessary to avoid changes to the watched objects ([config] and [events] attributes of <daypilot-scheduler>) in onScroll.

If you have dynamic loading enabled, it's necessary not to use [events] attribute at all. In that case, and with args.clearEvents = false, calling args.loaded() will incorporate the changes to the original events array and that will trigger another update and another onScroll event.

There is now a sample project available with a working Angular Scheduler infinite scrolling configuration, with some additional tweaks that improve performance and user experience.

https://code.daypilot.org/82376/angular-scheduler-infinite-scrolling

The explanation will be added soon to the tutorial.

Comment posted by Ruud
3 years ago.

Thanks for the reply. with you description i found that i still had the [events] attribute. After removing this it worked.

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