10 Replies Latest reply on Dec 19, 2011 8:15 AM by jlpktnst

    only second click is recognized

    nimo22

      I am using actual rf-version with rich:datatable in session-scoped.

       

      After clicking the button "fill datatable" my datatable is filled with data.

       

      Each row has a commandlink inside with "view details".

       

      When clicking the first time "view details", the action is not fired.

      However, when clicking the second time, the action is fired.

       

      Why is that so? How can I solve this?

        • 1. Re: only second click is recognized
          nimo22

          I do not know, if this is related to that issue:

           

          I am using jboss 7.0.2 and for every request I get this response:

           

          10:35:58,794 INFO  [org.apache.tomcat.util.http.Cookies] (http--127.0.0.1-8080-6) Cookies: Invalid cookie. Value not a token or quoted value

          10:36:00,609 INFO  [org.apache.tomcat.util.http.Cookies] (http--127.0.0.1-8080-5) Cookies: Invalid cookie. Value not a token or quoted value

          10:36:01,353 INFO  [org.apache.tomcat.util.http.Cookies] (http--127.0.0.1-8080-4) Cookies: Invalid cookie. Value not a token or quoted value

           

          https://issues.jboss.org/browse/AS7-1625?focusedCommentId=12647019

          • 2. Re: only second click is recognized
            pvito

            Hi, nimo stephan

            Would you show code of your rich:datatable ?

            • 3. Re: only second click is recognized
              stianst

              I've found out that if a form is re-rendered with ajax (render attribute on any link etc.) any links within the form doesn't work on the first click. My solution was to make sure the form is never re-rendered with ajax.

              • 4. Re: only second click is recognized
                nimo22

                The code:

                 

                I click the action "bean.fillDatatable" then it fills the datatable within the view "view_dt". All rows of the datatable has the action "bean.viewDetails". When I click it, the first click is not recognized. When clicking again, the click is recognized and fills the data in "view_details". Why is it not working with the FIRST CLICK?

                 

                This view has the action, which fills the database:

                <ui:composition ...  template="page.xhtml">

                <h:form>

                <a4j:commandLink value="fill datatable"

                                                action="#{bean.fillDatatable}"

                                                execute="@this" render=":view_dt" />

                </h:form>

                </ui:composition>

                 

                This view has the datatable with the action "view details":

                <ui:composition xmlns="http://www.w3.org/1999/xhtml"

                    xmlns:ui="http://java.sun.com/jsf/facelets"

                    xmlns:f="http://java.sun.com/jsf/core"

                    xmlns:h="http://java.sun.com/jsf/html"

                    xmlns:a4j="http://richfaces.org/a4j"

                    xmlns:rich="http://richfaces.org/rich">

                 

                    <h:panelGroup layout="block" id="view_dt">

                        <h:form id="form_table">

                            <rich:dataTable

                                value="#{bean.datatable}"

                                var="_dt" id="dt_cs">

                                <rich:column>

                                    <f:facet name="header">

                                        <h:outputText value="Id" />

                                    </f:facet>

                                    <h:outputText value="#{_dt.id}" />

                                </rich:column>

                ..

                                <rich:column>

                                <h:form prependId="false">

                                <a4j:commandLink action="#{bean.viewDetails(_dt.id)}" render=":view_details" value="Details"/>

                                </h:form>

                                </rich:column>

                            </rich:dataTable>

                        </h:form>

                    </h:panelGroup>

                </ui:composition>

                 

                This is the detals-view:

                <?xml version="1.0" encoding="UTF-8"?>

                <ui:composition xmlns="http://www.w3.org/1999/xhtml"

                    xmlns:ui="http://java.sun.com/jsf/facelets"

                    xmlns:f="http://java.sun.com/jsf/core"

                    xmlns:a4j="http://richfaces.org/a4j"

                    xmlns:h="http://java.sun.com/jsf/html">

                 

                    <h:panelGroup id="view_details" layout="block">

                    <h:panelGrid columns="2">

                        <h:outputText value="Id" />

                        <h:outputText id="name"

                            value="#{bean.entity.id}" />

                ..

                    </h:panelGrid>

                    </h:panelGroup>

                 

                </ui:composition>

                 

                All Views are visible on one page. I do not use any "rendered"-property.


                • 5. Re: only second click is recognized
                  nimo22

                  I have tried to update only the components within the views of a form, but it does not work either.

                  The first click is ignored. All following clicks are working.

                   

                  When clicking #{bean.fillDatatable} again, then the same procude: The first click is ignored. All following clicks are working.

                   

                  Is that a bug?

                  • 6. Re: only second click is recognized
                    stianst

                    I don't mean the rendered attribute, what I mean is the form being rendered using ajax, which it would be using the render attribute. Your commandLink that has the render=":view_dt" would cause the form to be rendered using ajax. Try to change it to render=":dt_cs" so it only renders the rich:dataTable and not the h:panelGroup+h:form.

                    • 7. Re: only second click is recognized
                      stianst

                      If not the same "bug" as I've seen, its seems to be related. My initial discussion on this was http://community.jboss.org/message/633464#633464. Never got any input from anyone on it though.

                      • 8. Re: only second click is recognized
                        nimo22

                        Thank you! Your solution works! Is that a known bug or limitation?

                        • 9. Re: only second click is recognized
                          stianst

                          That's what I've been trying to figure out. I was hoping to get some input from a RichFaces developer, but no luck.

                          • 10. Re: only second click is recognized
                            jlpktnst

                            This is a known bug. Acts similar as dynamic ui:include problem. Hence I removed all ajax for handling pages and only use it to refresh specific components. Use plain ol navigation for everything else. And if you have to refresh more than 1 component on ajax you can just separate em with spaces... (render="component1 component2 component3")