2 Replies Latest reply on Aug 29, 2007 11:54 AM by ylazzari

    Another h:selectOneMenu reRender problem within rich:dataTab

      Hi,

      I have yet another problem while trying to reRender a h:selectOneMenu inside a rich:dataTable.

      Assume the following template:

      <rich:dataTable value="#{myBean.someList}" var="item" ajaxKeys="#{myBean.ajaxKeys}">
       <rich:column>
       <f:facet name="header">Col 1</f:facet>
       <h:selectOneMenu id="menu1" value="#{item.attr1}">
       <s:selectItems value="#{myBean.listOfValues1}" var="val" label="#{val.label}"/>
       <a4j:support event="onchange" action="#{myBean.someAction}" reRender="col2" ajaxSingle="true"/>
       </h:selectOneMenu>
       </rich:column>
       <rich:column>
       <f:facet name="header">Col 2</f:facet>
       <a4j:outputPanel id="col2">
       <h:selectOneMenu id="menu2" value="#{item.attr2}">
       <s:selectItems value="#{myBean.listOfValues2}" var="val" label="#{val.label}"/>
       </h:selectOneMenu>
       </a4j:outputPanel>
       </rich:column>
      </rich:dataTable>
      


      Here we have a table with 2 columns, each of which contains a h:selectOneMenu. When the value is changed in the first one (menu1), it calls an action listener method in a bean (myBean.someAction) and then refreshes the second h:selectOneMenu (menu2). In the action listener method, I change the value of the attribute of the current item to which menu2 is bound (item.attr2). Basically, I would expect that the selected value in menu2 changes depending on which value is selected in menu1.

      The problem that I have is that menu2 is refreshed but its selected value doesn't change (I see in the log that the content of the "col2" panel is refreshed). I put "ajaxSingle=true" on "menu1" to make sure that it's only that value that will be decoded on the server and not the currently selected value for "menu2". I even put a break point in the setter for "item.attr2" to make sure that the only time that it's called is when I programmatically change the value in the method "myBean.someAction", and that is the case. Why does menu2 retain its selected value instead of being refreshed with the value I set in "myBean.someAction"?

      I use RichFaces 3.1.0 RC3 if it makes any difference.

      Thanks.