Recently I came across a scenario where in I had to enable Range Paging over my query based view object. In UI bean, I need to browse through all the rows if user choose select all option.
You cannot use regular viewObj.createRowSetIterator(null); to browse through all the rows. This will only allow you to browse through current range size rows.
You can use below code to browse all the rows:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void selectAll(ActionEvent actionEvent) { | |
DCBindingContainer bindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry(); | |
DCIteratorBinding dcItr = bindings.findIteratorBinding("CustomQueryBasedIterator"); | |
ViewObjectImpl viewObj = (ViewObjectImpl)dcItr.getViewObject(); | |
int rangePageCount = viewObj.getEstimatedRangePageCount(); | |
for ( int pageNo = 1 ; pageNo <= rangePageCount ; pageNo++ ){ | |
viewObj.scrollToRangePage(pageNo); | |
Row[] rowsInCurrentPage = viewObj.getAllRowsInRange(); | |
for(Row row : rowsInCurrentPage ){ | |
//TODO whatever operation you want to do | |
} | |
} | |
} |
Hi Bhargav,
ReplyDeleteThank you for the detailed blog.
I am trying to write a similar code but even after changing the page by calling scrollToRangePage(), the getAllRowsInRange() is always returning same rows.
What am I missing?
Regards
Ravi Sharma
Can you check your view objects access mode is Scrollable under tuning section ?
DeleteNo Bhargav, I have configured it to be "Range Paging". So basically I have done everything which your blog and this blog says: https://techiecook.wordpress.com/2010/08/26/using-range-paging-in-adf-an-example/
DeleteStill I get same set of rows when I call getAllRowsInRange().