2 Replies Latest reply on Mar 27, 2007 8:41 PM by Alex Walker

    nested a4j:outputPanel elements not re-rendering

    Alex Walker Newbie

      I'm having a little trouble getting ajax4jsf to re-render an element nested within an a4j:outputPanel. Essentially what I have is a drop-down menu with a4j:support attached that populates another drop-down when the value changes. This works fine, but I also want that menu to call another method via a4j:support when it changes, but I can't get this to work.

      In the code snippet below, everything works fine with the "category" drop-down change - the "loadNames" method is called and the items in the "CommodityNamePanel" panel are re-rendered. However, when I change the "name" drop-down, the "loadUnitType" method is never called and the "unitTypePanel" panel never re-renders. Can anyone suggest a way to make this work?

      <h:outputText value="Category" />
       <h:selectOneMenu value="#{checkInCommodity.category}" style="padding:0px;margin:0px;" id="category">
       <a4j:support event="onchange" action="#{checkInCommodity.loadNames}" reRender="CommodityNamePanel" />
       <f:selectItems value ="#{checkInCommodity.categoryList}" />
       </h:selectOneMenu>
      
       <h:outputText value="Type" />
       <a4j:outputPanel id="CommodityNamePanel">
       <h:selectOneMenu value="#{checkInCommodity.name}" style="padding:0px;margin:0px;" id="name">
       <a4j:support event="onchange" action="#{checkInCommodity.loadUnitType}" reRender="unitTypePanel" />
       <f:selectItems value ="#{checkInCommodity.nameList}" id="nameList"/>
       </h:selectOneMenu>
       </a4j:outputPanel>
      
       <h:outputText value="Unit Type" />
       <a4j:outputPanel id="unitTypePanel" ajaxRendered="true">
       <h:inputText value="#{checkInCommodity.unitType}" id="unitType" />
       </a4j:outputPanel>