af:table With Multiselection Can't Find Rowdata When Bound To A View Object Using Range Paging (Doc ID 1111214.1)

Last updated on MARCH 08, 2017

Applies to:

Oracle JDeveloper - Version: 11.1.1.3.0 and later   [Release: No Release Description and later ]
Oracle JDeveloper - Version: 11.1.1.3.0 and later ]
Information in this document applies to any platform.

Symptoms

You created an ADF Faces application, including an af:table with row selection set to multiple:
   <af:table ... rowSelection="multiple" ...

You use the following method in your backing bean to iterate over the selected rows and get the row data:
   public void pageShowSelection(ActionEvent actionEvent)
   {
       RowKeySet rowKeySet = getRangePageTable().getSelectedRowKeys();

       CollectionModel collectionModel = (CollectionModel) getRangePageTable().getValue();

       for (Object facesTreeRowKey: rowKeySet)
       {
           collectionModel.setRowKey(facesTreeRowKey);
           JUCtrlHierNodeBinding rowData = (JUCtrlHierNodeBinding) collectionModel.getRowData();
           String rowvals;
           if (rowData != null)
           {
               Row row = rowData.getRow();
               Object[] val = row.getAttributeValues();
               rowvals = "";
               for (int i = 0; i < val.length; i++)
               {
                   Object obj = val[i];
                   if (obj == null)
                       obj = "null";
                   rowvals += obj.toString() + "; ";
               }
           }
           else
               rowvals =
                       "Row data for row " + ((List<Key>) facesTreeRowKey).get(0).toString() +
                       " not found!";

           String out = getOutput();
           setOutput(out + "<br>" + rowvals);
       }
   }

This code correctly finds the row data When the View Object uses the standard 'Scrollable' access mode:
   100; Steven; King; SKING; ...
   102; Lex; De Haan; LDEHAAN; ...
   104; Bruce; Ernst; BERNS; ...


However, when the table is bound to a View Object which uses the 'range paging' access mode,
it cannot find the selected row data in the bean method (rowData is null in the above code), and you get
the selected key displayed:
  Row data for row oracle.jbo.Key[100] not found!
  Row data for row oracle.jbo.Key[102] not found!
  Row data for row oracle.jbo.Key[104] not found!

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms