1

I have a selectOneMenu that changes a value in the backing bean and based on that value, another component is being displayed or not. What I would like is to update that certain component after the value in the backing bean is changed by the selectOneMenu

<h:selectOneMenu value="#{backingBean.id.value}" >
            <f:selectItem itemLabel="Choose" itemValue="0"/>
            <f:selectItems value="#{backingBean.idList}"
                var="id" itemLabel="#{id.name}" itemValue="#{id.value}" />
             <p:ajax listener="#{backingBean.changeId}" process="@this" update="userMenu"/>
</h:selectOneMenu>
<p:menu id="userMenu" rendered="#{backingBean.id.value != 0}">
</p:menu>

The value changes in the backing bean but the is not updated.

Mircea Badescu
  • 291
  • 3
  • 7
  • 16

1 Answers1

0

This should work

<h:selectOneMenu value="#{backingBean.id.value}" >
        <f:selectItem itemLabel="Choose" itemValue="0"/>
        <f:selectItems value="#{backingBean.idList}"
            var="id" itemLabel="#{id.name}" itemValue="#{id.value}" />
         <p:ajax listener="#{backingBean.changeId}" process="@this" update="userMenuWrapper"/>
</h:selectOneMenu>
<p:outputPanel id="userMenuWrapper">
    <p:menu id="userMenu" rendered="#{backingBean.id.value != 0}"/>
</p:outputPanel>
Geinmachi
  • 1,251
  • 1
  • 8
  • 20