Showing posts with label Table. Show all posts
Showing posts with label Table. Show all posts

Wednesday 6 December 2017

Caused by: javax.el.PropertyNotFoundException: Target Unreachable, identifier 'row' resolved to null


When we are working with table there are some cases we face the following error:

by: javax.el.PropertyNotFoundException: Target Unreachable, identifier 'row' resolved to null


As per my findings, this issue will occur when we are working with LOVs in the table or with the QBE.

Working with LOVs:
   Is primary is part of the LOV then you can face this issue. To fix this issue then the suggested solution is to create surrogate key.

QBE:
   If you face this issue when you try to enable QBE, then make sure that you are not referring to the row in filter facets in the table columns.

By default QBE shows input textbox for all the columns, if you want to show different component like date component or LOV then Filter facets are used to render the different component when QBE is enabled.

  <f:facet name="filter">
     <af:selectOneChoice label="Access Mode" id="soc2" value="#{vs.filterCriteria.AccessMode}" simple="true">
         <af:selectItem label="#{null}" id="si4" value="#{null}"/>
         <af:selectItem label="Public" id="si5" value="1"/>
         <af:selectItem label="Private" id="si6" value="0"/>
     </af:selectOneChoice>
  </f:facet>

If you facing 'Target Unreachable, identifier 'row' resolved to null' issue with QBE then you have to make sure that you are referring to row attribute in the filter facet.
Ex:
<af:selectOneChoice label="Access Mode" id="soc2" value="#{row.bindings.pfscopeBean.AccessMode}" simple="true">

It should refer with the varstatus property like
 <af:selectOneChoice label="Access Mode" id="soc2" value="#{vs.filterCriteria.AccessMode}" simple="true">


Note:
Table definition in the jsff will be like:
<af:table value="#{bindings.myVO1.collectionModel}"
     var="row"
     rows="#{bindings.myVO1.rangeSize}"
     varstatus="vs"
.......
</af:table>

If above suggestion will not work try is by setting changeEventPolisy=ppr for the detail table iterator and the tree binding in the pageDef file

Monday 19 January 2015

Select All rows in ADF tabel

I got a requirement to provide 'Select All' option for ADF table. Tried a lot in different ways and finally got the solution with the following approach.

Code in UI:
 
<af:commandToolbarButton partialSubmit="true" text="Select All" id="cb1"
actionListener="#{myBean.selectAllListener}">
</af:commandToolbarButton> 

Code in the bean for selection listener is like this:
public void selectAllListener() {
  RowKeySet rkset = new RowKeySetImpl();
  CollectionModel model = (CollectionModel)myTable.getValue();
  int rowcount = model.getRowCount();
 
  for (int i = 0; i < rowcount; i++) {
     model.setRowIndex(i);
     Object key = model.getRowKey();
     rkset.add(key);
  }
 
  myTable.setSelectedRowKeys(rkset);
}

When we click on 'Select All' button, it will select all the rows from the model, adds to the selected row keys of the table and also displays the selected row count in the 'Rows selected' section in the status bar.

If the selection listener has makeCurrent entry, then the above approach may fail. When you select one row and then go for 'Select All', this wont work  to overcome this issue you can have selection listener code in the bean as follows:

public void selectAllListener() {
  RowKeySet rkset = myTable.getSelectedRowKeys();
  CollectionModel model = (CollectionModel)myTable.getValue();
  int rowcount = model.getRowCount();
 
  for (int i = 0; i < rowcount; i++) {
     model.setRowIndex(i);
     Object key = model.getRowKey();
     rkset.add(key);
  }
}

This means that, you are going to add remaining rows on top of selected rows.

Tuesday 30 April 2013

How to Stretch an ADF Table to occupy maximum width

ADF Table can be stretched to occupy the maximum width available by using AFStretchWidth Style Class.
Table can be embedded inside PanelStretchLayout or PanelCollection component

For PanelStretchLayout component the Table must be embedded inside the center facet, and the Style Class of both the Table and Layout component must be set to AFStretchWidth.
        <af:panelStretchLayout id="psl1">
          <f:facet name="bottom"/>
          <f:facet name="center">
            <af:table inlineStyle="AFStretchWidth" ...>
               ....
           </af:table>
          </f:facet>
          <f:facet name="start"/>
          <f:facet name="end"/>
          <f:facet name="top"/>
        </af:panelStretchLayout>

instead of using AFStretchWidth, you can decide which column will get stretched using the attribute columnStretching for example:
columnStretching="last"

  
 <af:table ... columnStretching="columnId_that_you_want_to_stretch" ...>