If there is network latency caused by big data loaded from remote location that makes it seem slow from end user perspective, then the initial data availability time can be quite reduced by loading data in multiple batches or pages.
Unlike remote loading of entire data in one batch which locks the UI of grid until all the data is fetched, in this process grid remains partially interactive while the remote data is being loaded in the background.
In pqgrid it's setup with 'dataModel.location: 'lazy'
option
while rest of the script remains same as in case of remote loading.
Feature | Lazy loading | Remote loading |
---|---|---|
dataModel.location | lazy | remote |
Application | Suitable for big data | Suitable for small data |
Grid interactivity while remote data is loaded | Remains mostly interactive | Not until entire data is loaded |
Progress bar | Present | Not applicable |
While there is no paging UI with this feature but lazy loading is dependent upon paging
No of records per batch or page is set with pageModel.rPP
option of grid.
Remote script is setp up in the same way as in remote paging example
Whenever new data is fetched from remote source, either initially or via call to refreshDataAndView
, the following events of interest are fired
in the given sequence:
beforeNewData
> lazyInit
> lazyProgress ( multiple times )
> lazyComplete
> complete