tbranyen / hyperlist

A performant virtual scrolling list utility capable of rendering millions of rows
Other
448 stars 45 forks source link

How would this work with data loading from ajax request? #61

Closed donnyv closed 5 years ago

donnyv commented 5 years ago

I thought maybe you could do a ajax request inside the generate() method. But that fires continuously while the user drags the scroll bar. That many requests wouldn't work for ajax.

Maybe if generate() was only called when it need the forward buffer of rows. That would help with no DDOS the ajax request.

Is there any other way to do this?

tbranyen commented 5 years ago

Definitely don't fetch in generate. You should fetch your data into a structure like an array and then get the data from that in generate. If the data isn't ready yet, then display a progress bar, once the data is available call refresh on the list.

Hope this helps!