0 Replies Latest reply on Mar 2, 2013 2:20 PM by Stephan Leutenmayr

    a4j:commandLink rerender renders old datalist

    Stephan Leutenmayr Newbie

      Hi,

       

      I use a rich:datalist to display comments on a website. The datalist is backed by a @Datamodel and generated by a @Factory. I want to use an a4j:commandLink to for voting on the single comments. Upon voting, the updated vote count should be displayed next to the commandLinks. The action of the commandLink is properly executed, but the datalist still displays the old vote count. Only upon site refresh (F5) is the updated vote count displayed. Also, the @Factory method for generating the datalist is execute prior to the actual action method of the commandLink. What do I have to do to achieve a display of the updated vote count?

       

      Thank you

       

      Stephan

       

       

      {code:xml}

      <a4j:outputPanel id="commentRegion">

                <a4j:form id="commentForm">

                          <rich:dataList id="commentList" var="item"

                                    value="#{allCommentsList}">

                                    <h:outputLabel value="#{item.comment.text}" />

                                    <br />

                                              <a4j:commandLink value="ja"

                                                        action="#{commentBean.rateComment('yes')}"

                                                        rerender="commentRegion" />

                                              <h:outputText value="(#{item.countYes})" />

                                              <a4j:commandLink value="nein"

                                                        action="#{commentBean.rateComment('no')}"

                                                        rerender="commentRegion" />

                                              <h:outputText value="(#{item.countNo})" />

                          </rich:dataList>

                </a4j:form>

      </a4j:outputPanel>

      {code}