7 Replies Latest reply on Jul 20, 2007 12:38 AM by technocrat

    AjaxCommandLink not working

    technocrat

      Hi All
      I have an ouputPanel which is rendered on the click of the button.I have given reRender attribute of the button as the id of the ouputPanel.This panel contains one commandlink which is not there in jsp but is constructed dynamically.The decode of this link is not being called when it is clicked.

      What might be the problem ?

      Please Help

      Balu

        • 1. Re: AjaxCommandLink not working

          post the code snippet, please. Still not enough into to suggest.

          • 2. Re: AjaxCommandLink not working
            technocrat

            This is the code snippet from the dialog.jsp.We are adding a link dynamically to div depending on the fieldType attribute using
            component.getChildren().add() method.This is done in the renderer of the div.

            Here a commandLink is added to the div membshpNumText on clicking which the decode is not invoked.

            But the decode of the link go is called without any problem.

            Only the link added dynamically has the problem.

            But if i change the rendered attribute of the dialog to '#{true}' its working.

            <a4j:outputPanel id="addMemberPanel">
             <i:dialog id="addMemberDialog" rendered="#{addMemberPageBean.showAddMemberDialog}">
            
            <i:div id="membshpNumText" fieldType="MEMBER">
             <h:inputText id="mem1" value="#addMemberToAccountPageBean.membershipNumber}"
             required="true" />
            </i:div>
            <a4j:commandLink id="go" action="#{addMemberPageBean.retrieveMemberDetails}"
             value="#{screenMsgs.go}" />
             ..........
            </i:dialog>
            </a4j:outputPanel>


            • 3. Re: AjaxCommandLink not working
              technocrat

              It seems the decode of the components added through component.getChildren().add() is not getting invoked,if the addition happens in an ajax request...

              am I missing anything ?

              • 4. Re: AjaxCommandLink not working

                'rendered' attribute of the outputPanel might be the culprit. If it equals flase at the beginning of the decode phase, the decode of it's content will not be decoded.

                What is the scope of the addMemberPageBean?

                • 5. Re: AjaxCommandLink not working
                  technocrat

                   

                  'rendered' attribute of the outputPanel might be the culprit. If it equals flase at the beginning of the decode phase, the decode of it's content will not be decoded.


                  When i debugged the code rendered is true and decoding is happening.But all children except the link got decoded.When i gave a log to check the children, the link was not there in the list.

                  The scope of my page bean is session

                  • 6. Re: AjaxCommandLink not working

                    did you explicitly assign id for the dynamically created link? If not, you should.

                    • 7. Re: AjaxCommandLink not working
                      technocrat

                      I got my mistake... I was adding the component in the render phase ...but the state saving happens before that...
                      Now i changed it and its working fine..

                      One question ...

                      Why the state saving happens before rendering is complete ?


                      Thanks for your replies...

                      Balu