sroze / ngInfiniteScroll

Infinite Scrolling for AngularJS
http://sroze.github.com/ngInfiniteScroll/
MIT License
2.89k stars 723 forks source link

Filtering data makes items grid less then window #309

Open tachyon-ops opened 8 years ago

tachyon-ops commented 8 years ago

Hi,

What if I have say 300 items array, and from those only 100 items are loaded on a 400% window height container, and then suddenly I want to filter all those items by say attribute 'X' which only 2 items from the 100 items has. These 2 items make the container so small, that you cannot scroll until infinite loading is activated.

How can we process this? Or should we check for the container height every time we filter? It's strange.

Any thoughts would be great! Awesome lib! Thanks!

graingert commented 8 years ago

Whenever the filter changes you should re-load the objects from the server

On 12 Aug 2016 5:03 pm, "Nuno Ribeiro" notifications@github.com wrote:

Hi,

What if I have say 300 items array, and from those only 100 items are loaded on a 400% window height container, and then suddenly I want to filter all those items by say attribute 'X' which only 2 items from the 100 items has. These 2 items make the container so small, that you cannot scroll until infinite loading is activated.

How can we process this? Or should we check for the container height every time we filter? It's strange.

Any thoughts would be great! Awesome lib! Thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sroze/ngInfiniteScroll/issues/309, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZQTPi6x8qithrgGO7KgbUS6coexVekks5qfJk_gaJpZM4JjOeg .

tachyon-ops commented 8 years ago

Hum... I'm fetching a json obj with all from the server and resenting +10 every infinite load, so my 'displayItems' array grows on each infiniteLoad iteration

Now, in such case one should be able to fire infinite load function if the filtered objects are so many as to leave the container grid with height < then window

So fetching again from server is not an option

tachyon-ops commented 8 years ago

I mean for ng-repeat filter, we should be able to trigger the inf. Function on such ocasions

tachyon-ops commented 8 years ago

Since the 're-load the objects from the server' might not be one's use case:

If anyone came across this issue and found no way to walk around it... infinite-scroll-listen-for-event="triggerInfinity" could work, but then again, one needs to check if container is less then window and trigger a 'triggerInfinity' event until all items are iterated. Documentation says something about another directive that should have something to do:

infinite-scroll-immediate-check (optional) - {boolean} - A boolean expression that indicates that the directive should check immediately to see if a scroll event would trigger an evaluation of the infinite scroll expression even if a scroll event does not occur. Useful if it's possible that the content inside the directive's element is not tall enough to fill up the entire browser window's height. Defaults to true.

Tried to switch to false, then again to true, no difference whatsoever, so I will implement code to check for the container's height every X second and if less, fetch more items until there is no more items.

Muskos commented 7 years ago

+1

kansalhimanshu commented 6 years ago

+1