in my page i have :
<p:dataTable id="myTable" lazy="true" widgetVar="myTable" value=".." paginator="true" paginatorPosition="bottom" rows="10" ...>
<p:ajax event="page" oncomplete="myTable" />
...
</p:dataTable>
in my bean :
...
private LazyDataModel list;
...
public void search() {
list = new LazyDataModel<SomeDTO>() {
private static final long serialVersionUID = 1L;
List<SomeDTO> result = null;
@Override
public List<SomeDTO> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) {
List<SomeDTO> result = service.search(searchedName, first, pageSize);
// SOME CODE HERE FOR PAGINATION ?? BUT WHAT
return result;
}
};
// HOW TO DELETE THIS EXTRA REQUEST
list.setRowCount(service.search(searchedName));
}
my question is how to setRowCount from result (size+1). i dont want to get the count from DB, because i'm sure we can calculate the rowCount without requesting DB.