Hi,
This is quite normal. Two database calls are needed, one call to compute the total number of rows in
the database and one to fetch the records to display.
regards
Bob
On 2011/10/02 05:19 AM, Budianto Lie wrote:
Hi,
I try sample data paging with PagingDataProvider.
It's working. But when I click on a paging number and inspect in the log
console, it see that the
table component call to getCountryService several times.
What's cause this problem?
table.setDataProvider(new PagingDataProvider<Country>() {
public List<Country> getData() {
int start = table.getFirstRow();
int count = table.getPageSize();
String sortColumn = table.getSortedColumn();
boolean ascending = table.isSortedAscending();
log.info <http://log.info>(start);
log.info <http://log.info>(count);
return getCountryService().findAll(start, count, sortColumn,
ascending);
}
public int size() {
int i = getCountryService().getTotalCountry().intValue();
log.info <http://log.info>(i);
return i;
}
});
Thanks,
Budianto