Wednesday, 27 November 2013

ADF : ValueChangeEvent : Forcefully execute all event change queued logic.

ValueChangeEvent : Forcefully execute all event change queued logic.


Problem: some times on valuechangeevent you will not get latest selected value.
Because, all valuechangeevent will go to queue, and it executes at particular ADF lifecycle.

Solution: to get the latest selected value, we need to manually execute the ADF lifecycle before taking the value.

##############Your code - from ValueChangeEvent method ##########################

yourMethod(ValueChangeEvent valueChangeEvent){

----------------
------------

this.setValueChangeEventComponentToNewValue(valueChangeEvent);

                ViewObject vo =
                    this.findIterator("MktImpJobs1Iterator").getViewObject();
                this.jobrow = vo.getCurrentRow();
----------------
 -------------

}

##############new method you need to add ##############

 public  void setValueChangeEventComponentToNewValue(ValueChangeEvent vce) {
            vce.getComponent()
               .getValueExpression("value")
               .setValue(FacesContext.getCurrentInstance().getELContext(),vce.getNewValue());
          
        }

 
########################################################

No comments:

Post a Comment