TouDick
TouDick

Reputation: 1322

Automatic lazy-loading in datatable from primefaces

Is there some easy way or maybe a ready component to use lazy-loading in dataTable by Primefaces but without pagination (also not the standard one) ?

I need following feature: when page is loaded dataTable contains only first 10 out of 100 rows (fast response time). The rest of rows is automatically loaded into the dataTable but user can already work with first portion of data.

Thanks for any advice. In worst case I will have to implement similar behavior by myself, but maybe someone already have some experience.

Upvotes: 1

Views: 3880

Answers (1)

BalusC
BalusC

Reputation: 1108722

The feature you're looking for comes very close with "live scrolling". It does load in the background, but only when the bottom is reached in scrolling. See the "DataTable - Scrolling" showcase page.

Here's an extract of relevance from the showcase example, showing the attributes you need:

<p:dataTable var="car" value="#{tableBean.carsLarge}" scrollRows="20"  
    scrollable="true" liveScroll="true" scrollHeight="150" id="dataTable4"> 

However, to achieve exactly your functional reqirement, you'd probably need to homebrew or post a new feature request to PrimeFaces guys.

Upvotes: 3

Related Questions