13 Replies Latest reply on Jun 26, 2007 7:38 AM by ilya_shaikovsky

    a4j:commandButton doesn't work in rich:dataTable

    antonovici

      Hi the a4j command link or button doesn't work in rich faces data table.If i cut the a4j:commandLink from the table and put it in a form it works perfecty.I am using the last snapshoot version for a4j and richfaces.

        • 1. Re: a4j:commandButton doesn't work in rich:dataTable
          ilya_shaikovsky

          Specify environment and paste your page code please.

          • 2. Re: a4j:commandButton doesn't work in rich:dataTable
            antonovici

            Hi,

            I'am using java 6 , Netbeans 5.5 and glassfish.
            <h:form id="asofForm">
            <rich:dataTable columns="5"
            cellpadding="0" cellspacing="0"
            width="700" border="0" var="item"
            value="#{backasocoffer.ofertaList}">

            .....

            <rich:column colspan="1" style="text-align :center ;">
            <a4j:commandLink value="Send"
            action="{backasocoffer.showPanel}"> </a4j:commandLink>
            </rich:column>

            ....

            public String showPanel(){
            System.out.println("Test");
            return null ;
            }

            In this version the backing bean method showPanel isn't invoked.But in this version the methd runs and the value test is displayed :

            <h:form>
            <a4j:commandLink value="Send"
            action="#{backasocoffer.showPanel}"
            >
            </a4j:commandLink>
            </h:form>

            • 3. Re: a4j:commandButton doesn't work in rich:dataTable
              antonovici

              I am tring to show in a modal panel some info regarding a clicked cell in a table.Is any other solution to this problem ? I need to pass a parameter to a backing bean action listener in order to display the corect info in the modal panel (that's why i haved used a4j:commadLink or a4j:commandButton). It works if i use h:commandLink instead a4j:commandLink.The panel displays corecty my info if i put the a4h:commandLink in a form without the dataTabe but this is not my goal.

              • 4. Re: a4j:commandButton doesn't work in rich:dataTable
                antonovici

                I have discoverd a problem.When a insert a h:comandLink in the rich:dataPanel doesn't execute on the first clik.On the second clik the action executes and the new page is displayed.When i return to the dataTable page the a4j:commandLink is executed and the text "Test" is displayed.So why the first clik on the link in the table is not executed ?

                • 5. Re: a4j:commandButton doesn't work in rich:dataTable
                  ilya_shaikovsky

                  Still can't reproduce this behaviour.

                  do not forget to use messages and a4j:log components to check for possible errors in the request lifecycle and its client side log.

                  • 6. Re: a4j:commandButton doesn't work in rich:dataTable
                    antonovici

                    I still think that there is a problem with the rich:dataTable

                    Here is my test code :

                    <%@page contentType="text/html"%>
                    <%@page pageEncoding="UTF-8"%>

                    <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
                    <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
                    <%@taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
                    <%@taglib prefix="rich" uri="http://richfaces.ajax4jsf.org/rich" %>

                    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                    "http://www.w3.org/TR/html4/loose.dtd">

                    <f:view>






                    <h:form>

                    <rich:dataTable value="#{backindex.lista}" var="item" >
                    <h:column >
                    <h:commandLink value="Go" action="asocOffers"/>
                    </h:column>
                    <h:column >
                    <h:outputText value= "#{item}"/>
                    </h:column>
                    </rich:dataTable>
                    </h:form>


                    </f:view>

                    and my backing bean

                    package back;

                    import java.util.ArrayList;
                    import java.util.List;


                    public class BackIndex {

                    /** Creates a new instance of BackIndex */
                    public BackIndex() {
                    }

                    private List lista = new ArrayList();

                    public List getLista() {
                    //lista.clear();
                    lista.add("Aaa");
                    lista.add("Bbb");
                    lista.add("Ccc");
                    lista.add("Ddd");
                    lista.add("Vvv");
                    lista.add("Rrr");
                    lista.add("Uuu");
                    return lista;
                    }

                    public void setLista(List lista) {
                    this.lista = lista;
                    }

                    }

                    When i click de link "Go" for the first time the form submits and doesn't forwards the the desired page.When i click for the second time the link the page is forwarded.Because of this problem i can't pass any params to the modal panel (regarding my previous posts) and i can't display the info in the panel.

                    • 7. Re: a4j:commandButton doesn't work in rich:dataTable
                      foli
                      "antonovici" wrote:

                      Hi,
                      I'am using java 6 , Netbeans 5.5 and glassfish.
                      <h:form id="asofForm">
                      <rich:dataTable columns="5"

                      </rich:column>

                       

                       

                      Hi dude. Could you help me?
                      I use NB 5.5 + java 5 + GlassFish.
                      I wanna use DropDowMenu form RichFaces framework but I can't

                       

                      I added in my project next libs:
                      - ajax4jsf-1.1.1.jar
                      - richfaces-3.0.1.jar

                       

                      But it dosen't work

                      • 8. Re: a4j:commandButton doesn't work in rich:dataTable
                        roykachouh

                        I am still having the same exact problem....This is definitely a bug with the rich:datatable...

                        Whenever i put the same command button outside the table, everything works as expected....

                        • 9. Re: a4j:commandButton doesn't work in rich:dataTable
                          antonovici

                          I've cahnged the rich:datatble component with an ordinary h:datatable in which the a4j:commandButton works ok.I've spent some time rewriting the code but in the end i was able to display dinamic information in the modal panel.I suggest to do the same until the issue is resolved.

                          • 10. Re: a4j:commandButton doesn't work in rich:dataTable
                            roykachouh

                             

                            "antonovici" wrote:
                            I've cahnged the rich:datatble component with an ordinary h:datatable in which the a4j:commandButton works ok.I've spent some time rewriting the code but in the end i was able to display dinamic information in the modal panel.I suggest to do the same until the issue is resolved.


                            Yep that did the trick...unfortunately, i lose all the "prettiness" of the rich:dataTable, as well as the rich pagination functionality :(.

                            Can anyone definitively confirm that this is indeed a bug with <rich:datatable, and perhaps when a solution might be available?

                            • 11. Re: a4j:commandButton doesn't work in rich:dataTable
                              roykachouh

                              what about another alternative? one, that will allow me to keep the rich data table, but bind to an action differently...i am sort of new to JSF, so is there a way to bind to an application action without using <h:commandLink> or <h:outputLink> ?

                              • 12. Re: a4j:commandButton doesn't work in rich:dataTable
                                antonovici

                                The paginator works with an regular h:dataTable.
                                What you lose is the subtable thing but you can make somthing similar with an nested datatable.If you play a little bit with the table header,borders using CSS you can end up with an copy of the rich:datatable.
                                They are 3 types of events in the jsf framework life cycle,value changed and action events.
                                In addition if you use the a4j you can add an ajax event to components using a4j:support.I've tried with a4j:support but it doesn't work in a rich:dataTable

                                • 13. Re: a4j:commandButton doesn't work in rich:dataTable
                                  ilya_shaikovsky

                                  plase attach full working war for investigations to

                                  http://jira.jboss.com/jira/browse/RF-375