4 Replies Latest reply on Apr 3, 2007 5:38 PM by Sergey Smirnov

    problem with commandLink

    Jay Lou Newbie

      Hi, I have just started using a4j tags. I put a <a4j:commandLink> on my column header for sorting. The problem is, nothing happens when I click on it the first two times. On the third click, and all subsequent clicks, the sorting function works just fine.

      I wonder if anyone had this problem before and know how it could be solved. Thank you very much!

        • 1. Re: problem with commandLink
          Sergey Smirnov Master

          post your code (page snippet and java class) please. What is you run-time environment.

          • 2. Re: problem with commandLink
            Jay Lou Newbie

            I'm using RAD 6.0. Here is my datatable, I omitted all but the first column:

            <h:dataTable border="1" cellpadding="1" cellspacing="0"
            headerClass="headerClass" footerClass="footerClass"
            rowClasses="rowClass1,rowClass2" styleClass="dataTable"
            id="familytbl" value="#{contactStartupMB.subscriberMB.eligibilityMB.memberDataModel}" var="family">
            <h:column id="familyCol1">
            <f:facet name="header">
            <h:panelGroup>
            <a4j:commandLink styleClass="commandLinkHeader"
            id="sortFamilyName" reRender="familytbl"
            actionListener="#{pc_MemberView.actionSortFamily}">
            <f:attribute name="sortField" value="familyName" />
            <h:outputText value="#{had.txtFamilyName}"
            styleClass="tableColHeader"></h:outputText>
            </a4j:commandLink>
            </h:panelGroup>
            </f:facet>
            <a4j:commandLink reRender="covtbl, firstName, lastName, familytbl"
            action="#{pc_MemberView.doSelectAction}">
            <h:outputText id="outFamilyName" styleClass="#{contactStartupMB.subscriberMB.eligibilityMB.memStyleClass}" value="#{family.name}" />
            </a4j:commandLink>
            <f:attribute value="center" name="align" />
            </h:column>
            </h:dataTable>

            As you can see, I have a commandLink for sorting, and a commandLink for populating another table. From the log file, the first time I click on either of those links, the AJAX request is sent, and response is received, but no update occurs; second time I click a link, no request was sent; third time, everything is fine.

            Thanks.

            Jay

            • 3. Re: problem with commandLink
              Jay Lou Newbie

              Never mind. I think the problem is I didn't put in an ID for the form. It's working fine now after I changed it.

              • 4. Re: problem with commandLink
                Sergey Smirnov Master

                I did no see the form in you code snippet :-(