LazyDataModel. BackBean JpaController, Netbeans, " JSR CRUD Entities" (BackBean @SessionScoped)
private LazyDataModel<Car> lazyModel;
private int pageSize = 5;
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getPageSize() {
return pageSize;
public void LoadData() {
lazyModel = new LazyDataModel<Car>() {
@Override
public List<Car> load(int first, int pageSize, String sortField, boolean sortOrder, Map<String, String> filters) {
List<Car> result = new ArrayList<Car>();
try {
result = getJpaController().findCarEntities(pageSize, first);
} catch (Exception ex) {
JsfUtil.addErrorMessage(ex, search);
}
return result;
}
};
lazyModel.setRowCount(getJpaController().getCarCount());
lazyModel.setPageSize(pageSize);
}
public LazyDataModel<Car> getLazyModel() {
return lazyModel;
}
lazyModel.setPageSize(pageSize);
0 http://code.google.com/p/primefaces/issues/detail?id=1544
<p:dataTable var="item" value="#{controller.lazyModel}"
rows="#{controller.pageSize}" paginator="true"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="9,12,15"
page=""
lazy="true"
dynamic="true"
id="pnlResult"
>