May 26, 2012

Refreshing a component depend on other

Let us say, I have two combo boxes, one is to display list of countries and another is to display the list of states corresponding to the country selected. Which mean, whenever I select a country from the drop down, the state combo box should refresh automatically with the list of states in the selected state. To implement this in ADF, we have to do below steps.

  • The country list should submit its value whenever it is selected. To do this the below property should set to the country combo box
<af:selectOneChoice label=" Country" id="soc2" autoSubmit="true" />
  • A listener method needs to be written to get list of stats when country is selected and the method should be set to the country component with the below property
<af:selectOneChoice label=" Country" id="soc2" autoSubmit="true" valueChangeListener=”#{bean.method}”/>
  • Whenever the country is submitted the state component should refresh. To do so, the below property should set to the state component
<af:selectOneChoice label=" State" id="soc3" partialTriggers="soc2" />

No comments:

Post a Comment