Iterating selected rows in an ADF Faces table

Posted by Frank Nimphius on Oracle Blogs See other posts from Oracle Blogs or by Frank Nimphius
Published on Wed, 12 Sep 2012 02:23:59 +0000 Indexed on 2012/09/12 21:45 UTC
Read the original article Hit count: 241

Filed under:

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
   //property         
   Row row = ((JUCtrlHierNodeBinding)table.getRowData(selectedRowKeyPath)).getRow();
   System.out.println("Print Test: " + row.getAttribute(1));
  }
   return null;
}


© Oracle Blogs or respective owner

Related posts about /Oracle/ADFv