Mojarra 2.1.2
Tomcat 7
Issue: When selection & pagination is enabled on a data table, pagination doesn't work after one or more rows are selected.
Can be reproduced at the PrimeFaces 3.0 Showcase
http://www.primefaces.org/showcase-labs ... eckbox.jsf
Select one or more rows on the page and try the pagination controls. Though the control shows that it moved to the next page, the data remains the same.
Reason:
Code: Select all
public boolean isPaginationRequest(FacesContext context) {
if(pageRequest == null) {
Map<String,String> params = context.getExternalContext().getRequestParameterMap();
pageRequest = params.containsKey(this.getClientId(context) + "_paging"); // ISSUE - returns FALSE when it's actually TRUE
}
return pageRequest;
}
Suggested Fix: (It's only been a week since I started using PrimeFaces, so this fix might not be the right one, but they fixed the problem I encountered).
Similar to few other methods on the DataTable, setting the Row Index to -1 before retrieving the client ID and paging param solves this issue.
Code: Select all
public boolean isPaginationRequest(FacesContext context) {
if(pageRequest == null) {
int rowIndex = this.getRowIndex();
this.setRowIndex(-1); // FIX
Map<String,String> params = context.getExternalContext().getRequestParameterMap();
pageRequest = params.containsKey(this.getClientId(context) + "_paging");
this.setRowIndex(rowIndex);
}
return pageRequest;
}
Edit: Should I create a new Issue for this?[*]
- Karan