The dataScroller
component offers lazy loading of a collection via AJAX when the page is scrolled down.
A basic definition of the dataScroller
component would be as shown here:
<p:dataScroller value="#{dataScrollerBean.cars}" var="car" chunkSize="10"> #{car.name} </p:dataScroller>
The data gets loaded with specified chunks where its size is determined with the chunkSize
attribute, and then the retrieved content will be appended at the bottom of the component.
The AJAX loading takes place when the page is scrolled down, and this is achieved by monitoring the vertical scrollbar. This can be modified by the mode
attribute, which has document
as its default value. When its value is set to inline
, the component starts to listen to the scroll event of the dataScroller
container.