Search code examples
jsforacle-adf

adf addpartialTarget dont render the UI component correctly


i have static LOV on my page with the following code :

 <af:selectOneChoice id="soc4" autoSubmit="true" valueChangeListener="#{pageFlowScope.Bean.change}"  required="true">
     <f:selectItem itemLabel="#{viewcontrollerBundle.occ}" itemValue="1"/>
      <f:selectItem itemLabel="#{viewcontrollerBundle.leave}" itemValue="2"/>
      <f:selectItem itemLabel="#{viewcontrollerBundle.hold}" itemValue="3"/>
   </af:selectOneChoice>

and there is a button that is rendered by a boolean showbutton on the backing bean :

       <af:button bindings="#{pageFlowScope.bean.button}" partialTriggers="soc4" actionListener="#{bindings.CreateWithParams.execute}" 
        text="#{viewcontrollerBundle.insert}"
        rendered="#{pageFlowScope.LandsCostsBean.showbutton}" id="b2"/>

and in the valueChangeListener i change the showbutton to true and try to refresh the button to rendered it but it didn't work correctly as the showbutton value isn't changed ! and this the code in the backing bean :

      public void change(ValueChangeEvent vce) {
    try {
        Number type= new Number(vce.getNewValue());
        rangeType=landType;
        showbutton=true; 
        filterLandRangeCostByType(landType); 
        button.setVisible(true);
        AdfFacesContext.getCurrentInstance().addPartialTarget(button);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

Solution

  • In Oracle ADF if you want to refresh a component and all it's attribute you need to add the PPR on it's parent component.

    In your case :

    AdfFacesContext.getCurrentInstance().addPartialTarget(button.getParent());