8 Replies Latest reply on Apr 21, 2011 9:42 AM by wenggh007

    a4j:commandLink can not work, bug?

    wenggh007

      code below:

       

      <a4j:outputPanel id="second">

        

          <h:form id="cform">

         

            <rich:dataTable width="700" var="items" value="#{dictionaryBean.items}" ">

                     

                <rich:column>

                          <f:facet name="header"><h:outputText value="type"/></f:facet>

       

                           <a4j:commandLink value="delete" action="#{dictionaryBean.deleteItem}">

                                       <a4j:ajax execute="@form" event="mousedown"/>                   

                           </a4j:commandLink>         

             

                  </rich:column>

           

             </rich:dataTable>

       

           </h:form>

       

         </a4j:outputPanel>

       

       

      public void deleteItem(){

           System.out.println(""); 

      }

       

       

      --------------------------press the delete,the link no respond........ help!

        • 1. a4j:commandLink can not work, bug?
          wenggh007

          forgot it:

           

          version :richfaces4.0final +,jsf2.1

          • 2. a4j:commandLink can not work, bug?
            feuyeux

            I encounter a relevant issue, when I click twice, it works. And now, I devort to find the reason and solve it

             

            If you try to click twice time and it doen't work, please add immediate="true" to the link component.

             

            If still not work, find other component's wrong.

             

            Addionally, you can listener the cycle of jsf, find in which phase the flow failed.

             

            Hope you solve it.

            • 3. a4j:commandLink can not work, bug?
              ilya_shaikovsky

              a4j:command do not need the a4j:ajax to be added. it already provides all the same functionality and attributes out of the box.

              • 4. a4j:commandLink can not work, bug?
                wenggh007

                my program has three form in a page.

                 

                 

                <body>
                  <h:panelGrid style="text-align: center">
                    <h:form>
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                     <tr>
                      <td width="16%" class="rf-dt-shdr-c">catalog:</td>
                      <td width="23%">
                       <h:selectOneMenu valueChangeListener="#{dictionaryBean.valueChanged}">
                        <f:selectItems value="#{dictionaryBean.groupOptions}" />
                        <a4j:ajax event="valueChange" render="second,third" execute="@all" />
                       </h:selectOneMenu>
                      </td>
                      <td><h:commandLink value="add" action="#{dictionaryBean.addCatalog}" target="_blank"/> </td>
                     </tr>
                    </table>
                   </h:form>
                  
                   <a4j:outputPanel id="second">
                  
                    <h:form id="cform">
                   
                      <rich:dataTable width="700" var="items" value="#{dictionaryBean.items}" onrowmouseover="this.style.backgroundColor='#F1F1F1'"
                                onrowmouseout="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
                               style="width:700px;" id="dataResult">
                       
                        <rich:column>
                         <f:facet name="header"><h:outputText value="info"/></f:facet>
                         <h:outputLabel value="#{items.key}"/>
                        </rich:column>
                       
                        <rich:column>
                         <f:facet name="header"><h:outputText value="option"/></f:facet>
                         <h:outputLabel value="#{items.value}"/>
                        </rich:column>
                       
                         
                          <h:column>
                         <f:facet name="header"><h:outputText value="op"/></f:facet>
                         <h:commandLink onclick="if(!confirm('delete?'))return false;"  value="delete" target="_self">
                           <f:param value="delete" name="type"/>
                           <f:param value="#{dictionaryBean.dictionaryGroup.id}" name="groupID"/> 
                           <f:param value="#{items.key}" name="key"/>                          
                         </h:commandLink>                 
                        </h:column>
                       
                         <rich:column>
                   
                                        <f:facet name="header"><h:outputText value="type"/></f:facet>
                         
                                         <a4j:commandLink value="delete" action="#{dictionaryBean.deleteItem}">

                                                 <f:param value="#{dictionaryBean.dictionaryGroup.id}" name="groupID"/> 

                                                  <f:param value="#{items.key}" name="key"/>


                                                <a4j:ajax execute="@form" event="mousedown"/>                   
                                     </a4j:commandLink>         

                                 </rich:column>

                       
                       
                         
                       </rich:dataTable>
                     </h:form>
                   </a4j:outputPanel>
                  
                      
                    <h:form id="third">
                     <table>
                      
                      <h:inputHidden value="#{dictionaryBean.dictionaryGroup.id}"/>
                       <tr>
                        <td class="rf-dt-shdr-c">info</td>
                        <td><h:inputText  value="#{dictionaryBean.item.key}" /></td>
                       </tr>
                      <tr>
                       <td class="rf-dt-shdr-c">option</td>
                       <td><h:inputText  value="#{dictionaryBean.item.value}" /></td>
                      </tr>
                    </table>
                    <table>
                      <tr align="center">
                       <td>
                       <a4j:commandButton value="save" render="cform-dataResult"  action="#{dictionaryBean.addItem}">
                        <a4j:ajax event="mousedown" execute="@form" />
                       </a4j:commandButton>
                       </td>
                      </tr>
                      </table>
                   </h:form>
                  </h:panelGrid>
                </body>

                 

                 

                ---------------------------------------------------i guess:may be several forms conflict.......write that have any  problems?

                • 5. a4j:commandLink can not work, bug?
                  wenggh007

                    <a4j:commandLink value="delete" action="#{dictionaryBean.deleteItem}" execute="@this" immediate="true">

                             <a4j:param name="key" value="#{items.key}" />

                             <a4j:param name="groupID" value="#{dictionaryBean.dictionaryGroup.id}" />

                                       </a4j:commandLink>   

                   

                   

                  -------------------------------------------wtrite like this.still no respond.....crying...

                  • 6. a4j:commandLink can not work, bug?
                    wenggh007

                    i fond it     .if the code run alone.then ok    .but run in these forms.then can't work as well.the reason?

                    • 7. a4j:commandLink can not work, bug?
                      ilya_shaikovsky
                      • 8. a4j:commandLink can not work, bug?
                        wenggh007

                        thanks all, i seem to be able to solve the problem.i amgoing to try to check it