Ngx-infinite-scroll: Issue when resetting array

Created on 19 Feb 2018  路  9Comments  路  Source: orizens/ngx-infinite-scroll

Hi,

I found that when using infinite scroll that if I load an initial list and trigger the scrolled event that this obviously works fine. But if I then reset the array to empty and load the initial 100 items again then the scrolled event never seems to trigger after that (I think it's still expecting me to be able to scroll down as far as the items it loaded before I emptied the array?) (Think this might be the same issue as https://github.com/orizens/ngx-infinite-scroll/issues/236)

I've amended your plunkr to demonstrate the issue I'm having - to recreate:

  1. Scroll until it says 120 items at the top
  2. Hit the refresh button at the top
  3. Try to scroll past 100...

https://plnkr.co/edit/VCfFWgyKPSqjoKoc4bnc?p=preview

I have the same issue when changing the date range I am showing results for/ordering the columns because everytime we reset the array and display only the initial data again.

Thanks in advance for your help.

enhancement investigating

Most helpful comment

@vickieallen since the content is changing - i can suggest to disable and enable the infinite-scroll again.

All 9 comments

hi @vickieallen
you're right - this behavior happens.
i'm not sure whether this is a bug or related to the responsibility of ngx-infinite-scroll.
will need to think how to tackle this one.

Hi @orizens,

I had seen this issue by luck and I think it's the same thing than me with the ordering of column as mentioned by the author.

So I close my issue #230 because in this issue, you have a proof of the problem

@vickieallen since the content is changing - i can suggest to disable and enable the infinite-scroll again.

closing as - this issue (a resize event) is linked to this problem
https://github.com/orizens/ngx-infinite-scroll/issues/91

@vickieallen since the content is changing - i can suggest to disable and enable the infinite-scroll again.

How do I do that?

@vickieallen since the content is changing - i can suggest to disable and enable the infinite-scroll again.

How do I do that?

use infinitScrollDisabled input

@marcvannieuwenhuijzen @chaouiy This worked for me but because I was doing the sorting locally I needed to set a timeout for about 500ms before re-enabling the infinite scroll. Have you found a better workaround?

@fyidev I invoke this._changeDetector.detectChanges(); instead of setTimeout()
It works for me.

Was this page helpful?
0 / 5 - 0 ratings