7 Replies Latest reply on Jan 11, 2008 3:41 PM by jmatters

    ReRenderd UIcommand not working

    jmatters

      Hello,

      I am currently encountering a problem when I try to call any UIcommand element be it <h:command... or <rich:command... that was generated via a reRender of a h:dataTable. The defined action is simply not called.

      If the element is present in the list from the page rendering on, the UIcommand works. If the element are added through a reRender the problem appears.

      I'm using richfaces 3.1.3.GA with seam 2.0.0.GA on jboss 4.2.2.GA.

      I think I have read about this problem before, but is there any workaround, or is there a jira issue for that?

      - Chris

        • 1. Re: ReRenderd UIcommand not working
          ilya_shaikovsky

          you may not reRender that component that didn't present in DOM tree before request. Instead you should reRender some parent that was actually on the page before request.

          • 2. Re: ReRenderd UIcommand not working
            jmatters

            Hi, thanks for your reply!

            I am rerendering a parent object that is present from the page rendering on. It's a datatable:

            <h:form>
             <h:dataTable id="personSearchResult" var="person"
             value="#{personList.searchPersons}">
             <h:column>
             <a4j:commandLink action="#{CaseHome.addPerson(person.id)}" value="#{person.givenName} #{person.familyName}" reRender="personList" ></a4j:commandLink>
             </h:column>
             </h:dataTable>
            </h:form>
            


            Now #{personList.searchPersons} is null at page rendering. But then I've got:

            <h:form>
             <h:inputText value="#{personList.person.givenName}">
             <a4j:support event="onkeyup" requestDelay="400" reRender="personSearchResult" action="#{personList.resultList}"></a4j:support>
             </h:inputText>
            </h:form>


            and when #{personList.person.givenName} is not empty #{personList.searchPersons} returns a list. The table and the a4j:commandLinks are rendered perfectly fine, but the command links don't call the action...

            Any hints appreciated!

            - Chris

            • 3. Re: ReRenderd UIcommand not working

              you need to define the ide of the command component explicitly if it is in the rerendered area. Otherwise, the id of the regenerated component might not match the id assigned during the component tree restoring of the first JSF phase. This mismatch is not only one, but a very strong reason when the action is not processed on postback.

              • 4. Re: ReRenderd UIcommand not working
                jmatters

                Hi, I added an id to the commandLink:

                <a4j:commandLink id="addPersonLink" action="#{CaseHome.addPersonX(person.id)}" value="#{person.givenName} #{person.familyName}" reRender="personList" ></a4j:commandLink>
                


                Sadly the action is still not being called...

                The rendered commandLink now looks like this:
                <a href="#" id="personSearchList:0:j_id86:addPersonLink" name="personSearchList:0:j_id86:addPersonLink" onclick="A4J.AJAX.Submit('_viewRoot','personSearchList:0:j_id86',event,{'parameters':{'personSearchList:0:j_id86:addPersonLink':'personSearchList:0:j_id86:addPersonLink'} ,'actionUrl':'/case.seam?javax.portlet.faces.DirectLink=true'} );return false;">Test Person</a>
                


                - Chris

                • 5. Re: ReRenderd UIcommand not working

                  what the scope of the bean you use for the list ?

                  • 6. Re: ReRenderd UIcommand not working
                    jmatters

                    The bean is a seam component. It's kept in the seam coversation context.

                    • 7. Re: ReRenderd UIcommand not working
                      jmatters

                      I solved the problem by moving the list to a stateful bean, it's scope is also the seam conversation context.

                      Thanks for your help!

                      - Chris