Thursday, July 21, 2011

ADF manual LOV binding backing bean selected value

Ok so I tried this a whole bunch of ways and this is the way I will follow from now on to save my self MUCH hassle.

What I want is a VO based SelectOneItem that has an empty selected item which is selected by default. Also the value of the SelectItem must be custom and NOT index based.

  • The Backing Bean

  private String selectedCode = null;
  public String getSelectedCode() {     return selectedCode;   }   public void setSelectedCode(String selectedCode) {     this.selectedCode = selectedCode;   }

  • The jspx page
  <af:selectOneChoice value="#{viewScope.yourBean.selectedCode}"     label="#{viewBundle.JSPXNAME_LBL_YOURLABEL}"     required="#{bindings.YourLovCode.hints.mandatory}"     shortDesc="#{bindings.YourLovCode.hints.tooltip}" id="soc4"     styleClass="colspec_medium" unselectedLabel="" valuePassThru="true">
      <af:forEach items="#{bindings.YourLOVIterator.allRowsInRange}" var="item">
        <f:selectItem id="si3" itemLabel="#{item.attributeValues[1]}" itemValue="#{item.attributeValues[0]}"/>       </af:forEach>                  

No comments:

Post a Comment