orizens / ngx-infinite-scroll

Infinite Scroll Directive for Angular
https://www.npmjs.com/package/ngx-infinite-scroll
MIT License
1.23k stars 223 forks source link

Scrolled callback not called after container div resize. #299

Closed aaronscherbing closed 5 years ago

aaronscherbing commented 6 years ago

I've just updated to ngx-infinite-scroll 6.0.1, as I'm working through updating to Angular 6. I'm noticing strange behavior that I hadn't noticed before.

I've got a vertical list of divs loaded inside a container div set to scroll with ngx-infinite-scroll. When I scroll down initially, I receive the scrolled callback, and I load more rows into that container, extending it's height.

Now the problem arises when I refresh the data (loading only the first N rows). The container div shrinks vertically, because the number of loaded rows has decreased. However, when I scroll down this time, I don't get the scrolled callback.

An interesting note: When I toggle infiniteScrollDisabled to true and then false after the refresh, I then can get the scrolled callback to call. It seems to reset whatever state was preventing the callback. This is the workaround I'm using for the time being.

Expected Behavior

Scrolling down should trigger a scrolled event.

Actual Behavior

The scrolled event is missed after the container div has been resized.

Steps To Reproduce / Demo (if applicable)

I wish I could put together a demo, but I don't have time to do that currently. I'll attach a screen recording.

scrolling_broken

Context

I'm trying to refresh the list and scroll down again.

Your Environment

Angular 6.1.1 ngx-infinite-scroll 6.0.1 Chrome

XerneaX commented 5 years ago

i think i have a same problem when i filter the list scroll doesnt triggered

kevincaradant commented 5 years ago

Hi

Indeed, I didn't have time to create this issue but I get exactly the same issue in my project.

Thanks for the workaround

dalepo commented 5 years ago

I have the same problem with 7.0.1

orizens commented 5 years ago

@Spawnrad can you reproduce on stackblitz or other?

Spawnrad commented 5 years ago

@orizens i have made lot of changes in my code and it work now, have used infiniteScrollDisabled. Thank you.