5 Replies Latest reply on Dec 22, 2008 2:48 PM by Michał Piotrowski

    a4j:commandButton incorrectly generated when rerendering ric

    Michał Piotrowski Newbie

      I have a problem: when I rerender rich:dataTable then a4j:command... elements are incorrectly generated. They are wrongly connected with request scope variable, declared in rich:dataTable. Here is my example JSP:

      <h:form>
      <h:selectOneListbox value="#{BooksFormBean.selectedAuthor}">
       <a4j:support event="onchange" reRender="books" ajaxSingle="true"/>
       <f:selectItems value="#{AuthorsBean.authors}" />
      </h:selectOneListbox>
      <a4j:outputPanel id="books">
       <rich:dataTable var="Book" value="#{BooksFormBean.selectedAuthor.booksCollection}">
       <rich:column>
       <f:facet name="header"><h:outputText value="Title"/></f:facet>
       <h:outputText value="#{Book.title}" />
       </rich:column>
       <rich:column>
       <a4j:commandLink value="Add" actionListener="#{BooksFormBean.addActionListener}"
       ajaxSingle="true" />
       </rich:column>
       </rich:dataTable>
      </a4j:outputPanel>
      </h:form>
      


      I expect that in action listener I can access var="Book" from faces context using following code:
      Book added = (Book) FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get("Book");
      

      but the request scope variables are populated correctly only on the first rich:datatable rendering. After rerendering the table request scope variables aren't repopulated according to the new table state.

      Is it an error in RichFaces or am I missing something?