The blog for hints & tips about Oracle Application Development Framework and Mobile Application Framework

  • ADFv
    September 12, 2012

Iterating selected rows in an ADF Faces table

Frank Nimphius
Master Principal Product Manager

In OTN Harvest May 2012; http://www.oracle.com/technetwork/developer-tools/adf/learnmore/may2012-otn-harvest-1652358.pdf I wrote about "Common mistake when iterating <af:table> rows". In this entry I showed code to access the row associated with a selected table row from the binding layer to avoid the problem of having to programmatically change the selected table row.

As it turns out, my solution only worked fro selected table rows that are in the current iterator query range. So here's a solution that works for all ranges

public String onButtonPress() {
RowKeySet rks = table.getSelectedRowKeys();
Iterator it = rks.iterator();while (it.hasNext()) {
List selectedRowKeyPath = (List)it.next();
//table is the JSF component reference created using the table's binding
Row row = ((JUCtrlHierNodeBinding)table.getRowData(selectedRowKeyPath)).getRow();
System.out.println("Print Test: " + row.getAttribute(1));}return null;

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.