Clarification about Angular 1 InfiniteList refresh(), and canceling refresh()
I am using MEAN.JS and have created an infinite list as such:
Here is the delegate defined in Angular:
So here is where I would appreciate clarification. In my use cases, the infinite list refreshes by itself without me having to call refresh(). The infinite list is in a splitter, so my guess is that the infinite list refreshes every time the splitter is opened/closed. Is there an actual reason as to why the infinite list refreshes without me calling refresh()?
Which brings me to the question: Is there a listener for pre/post refresh(), like Dialog pre/post open/close? I could not find any documentation on this.
I am using Google Maps, and would like to cancel refresh() if the bounds have not changed.
@rgins16 Can someone please answer this
@rgins16 Please understand that many of us are spread out around the world and time zones impact responses. For me, I do not know anything about Mean.JS, so I chose to not answer the question for fear of misguiding you.
As far as what I can answer, there are not any listeners as you have requested per the documents here: https://onsen.io/v2/docs/js/ons-lazy-repeat.html I do not know why refresh would be called without explicitly being so, but what I assume is happening, is the list is being reloaded to default. Is this correct? Meaning, you have scrolled down to say items 30-40 but upon reopening the splitter it shows the first 0-10.
@rgins16 Lazy repeat loads and unloads elements automatically and listens to the page
resizeevents to refresh the view.
refresh()method is provided just to allow a manual render when the user changes the lazy repeat content but no scroll is performed. For example, if you change the array of items provided to the delegate object with another array that has the same length, you’ll need to manually call
refresh()because lazy repeat is not watching the list itself, just the scroll/resize events.
So, for the question
Is there an actual reason as to why the infinite list refreshes without me calling refresh()
Well, I’d say yes, there’s definitely a good reason. It’s the way it should work
However, I don’t think the lazy repeat refreshes when the splitter is opened or closed. There is no pre-refresh or post-refresh as it is refreshing continuously on scroll event.
Just to make sure, are you using lazy repeat with a list of thousands of items? This is the only case where lazy repeat is useful. If you just want a
ng-repeatI don’t think this component is the best for you, as it’s not devised for that purpose. You might want to use a normal list or page’s
@munsterlander Thank you for not misguiding me. What led me to my second comment is that I saw new posts were being answered, and believed mine had fallen under the radar. I understand that everyone is busy and response times vary. I apologize if I came across as rude.
@Fran-Diox Thank you for your explanation. I now see the error in my previous way of thinking about lazy repeat.
The lazy repeat does not refresh every time the splitter is opened or closed, just the very first time it is opened. It also refreshes every time I scroll.
There are currently very few items in the lazy repeat, but due to the nature of the app I am building, there is a potential for the list to contain thousands of items.