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 | |
} | |
} | |
} |