Issue with ADF table range paging and sorting
Hello,
We have a requirement to support pagination in ADF tables. For this, we have made use of Range paging access mode in the view object level. The paging works perfectly fine with this. But we have another requirement of letting the user do a sort on the table (Yes!! The paginated table). The sort should be applied on all rows in the db and the control should return to the first row.
Applying sort as it is provided by the fwk, sorts the records in the obtained range only. So we have over ridden the Sort listener in Managed bean for this and are able to acheive the sorting of all rows through a AM method call. We are seeing a problem after this. If the sort action is applied to the key attribute then the previous and next range navigation works fine. If the same action is applied to non-key field, then some times (yea!! This is not consistent) the next set is not fetched.
Here is the code snippet that is called on Next navigation:
Map<String,Object> pfScope = AdfFacesContext.getCurrentInstance().getPageFlowScope();
Object objPageNumber = pfScope.get("pageNumber");
int pageNumber = 0;
if(null != objPageNumber)
{
pageNumber = new Integer(objPageNumber.toString()).intValue();
}
BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
JUCtrlRangeBinding view = (JUCtrlRangeBinding)bindings.getControlBinding("GeDmRequestVO");
int iRange = getTable().getAutoHeightRows();
int currentPage = view.getIteratorBinding().getNavigatableRowIterator().getRangeStart()/(iRange + 1);
System.out.println("Before " + view.getIteratorBinding().getNavigatableRowIterator().getRangeStart());
System.out.println("Current : " + currentPage);
System.out.println("Page Number : " + pageNumber);
System.out.println("Range : " + iRange);
System.out.println("Value : " + iRange*(currentPage + pageNumber));
view.getIteratorBinding().getNavigatableRowIterator().scrollRange(iRange*pageNumber);
System.out.println("After " + view.getIteratorBinding().getNavigatableRowIterator().getRangeStart());
Although, the new values are not refreshed in the table, the SOPs for before and after print the proper range sizes. And as I mentioned above, the above code works perfectly fine if there is no sort applied or when key attribute is sorted.
Would appreciate your help on this regard with navigation after non-key attribute sort.
Thanks,
Chitra.