SitePen / dgrid

A lightweight, mobile-ready, data-driven, modular grid widget designed for use with dstore
http://dgrid.io/
Other
628 stars 295 forks source link

OnDemandGrid with indefinite totalLength #1323

Closed fredfortier closed 4 years ago

fredfortier commented 8 years ago

My app uses OnDemandGrid with a custom dstore implementation.

I've implemented the fetch() and fetchAll() methods of the store to retrieve data. All is well insofar as I can return an accurate totalCount along with the data.

However, I just came across a edge case where the server is just unable to give me a total count. This means that I cannot return an accurate totalLength when calling fetch() or fetchAll(). I tried assigning null to totalLength but dgrid stops looking after the first page.

Is there provision for infinite scrolling with unknown totalLength within dgrid? If not, my first thought is to re-calculate totalLength during each fetch() call by adding the page size to the number of rows retrieved so far. Would this be the recommended approach or I am missing a better solution?

msssk commented 4 years ago

dgrid only supports rendering known datasets, and as such is not suitable for endless scrolling. In order to provide virtual scrolling dgrid must know the total number of records.