13 Replies Latest reply on Jul 1, 2009 9:34 AM by John Who

    Problem with a4j:commandLink within table

    John Who Newbie

      Hi folks,

      I'm trying to use a a4j:commandLink within a table.
      But when I click on the Link there is no action called.

      So what I'm trying to reach is that you first have to push a button to get a table filled. And then - after pushing a button/link in the table a new "area" (in my case the details) get displayed.

      What am I doing wrong?

      Here is some code:

      <f:view>
      <rich:panel header="Header">
      
       <h:outputText value="blabla" />
       <h:panelGrid columns="1" width="100%" border="0" cellspacing="0" cellpadding="0" columnClasses="alignRight">
       <a4j:commandButton actionListener="#{mb.search}" value="Search" reRender="liste" />
       </h:panelGrid>
      
      </rich:panel>
      
      <br>
      <rich:scrollableDataTable value="#{mb.liste}" var="list" width="70%" height="100px" id="liste">
       <rich:column>
       <f:facet name="header"><h:outputText styleClass="headerText" value="Name" /></f:facet>
       <a4j:commandButton actionListener="#{mb.showDetails}" value="Detail" reRender="detail" />
       </rich:column>
      </rich:scrollableDataTable>
      
      <rich:panel header="Detail" style="width: 70%;" id="detail" rendered="#{not empty mb.detail}">
       <h:outputText value="Test" />
      </rich:panel>
      
      </f:view>


      When I use the first button "Search" the list get filled.
      Now there a a few entries in the table with each of them has a new button "Detail". But when I click on this button, I don't reach my method in the bean ;(

      And another problem:
      Since I added the a4j:button in the table the header fields don't get displayed!?



        • 2. Re: Problem with a4j:commandLink within table
          Alexander Chubenko Newbie

          Hello.
          You can try to surround your link with <h:form> or <a4j:form>.

          • 3. Re: Problem with a4j:commandLink within table
            John Who Newbie

             

            "AngelDSTU" wrote:
            Hello.
            You can try to surround your link with <h:form> or <a4j:form>.


            it is already. Not within the 'rich:scrollableDataTable' but directly at the beginning of the jsp.

            Is there basically a problem to combine a 'rich:scrollableDataTable' with an 'a4j:commandLink'? Because when I add the exact 'a4j:commandLink' after the table there is no problem!

            <rich:scrollableDataTable value="#{mb.liste}" var="list" width="70%" height="100px" id="liste">
             <rich:column>
             <f:facet name="header"><h:outputText styleClass="headerText" value="Name" /></f:facet>
             <a4j:commandLink actionListener="#{mb.showDetails}" value="Detail" reRender="detail" />
             </rich:column>
            </rich:scrollableDataTable>
            


            this code doesn't work.
            But the next code does:

            <rich:scrollableDataTable value="#{mb.liste}" var="list" width="70%" height="100px" id="liste">
             <rich:column>
             <f:facet name="header"><h:outputText styleClass="headerText" value="Name" /></f:facet>
             <h:outputText value="Detail" />
             </rich:column>
            </rich:scrollableDataTable>
            <h:panelGrid columns="1" width="70%" border="0" cellspacing="0" cellpadding="0" columnClasses="alignRight">
             <a4j:commandLink actionListener="#{mb.showDetails}" value="Detail" reRender="detail" />
            </h:panelGrid>
            


            • 4. Re: Problem with a4j:commandLink within table
              Ilya Shaikovsky Master

              which RF version used?

              • 5. Re: Problem with a4j:commandLink within table
                John Who Newbie

                 

                "ilya_shaikovsky" wrote:
                which RF version used?


                3.2.1.GA

                • 6. Re: Problem with a4j:commandLink within table
                  Ilya Shaikovsky Master

                  pelase check 3.3.1GA. there were such issues previously.. should works under latest GA.

                  • 7. Re: Problem with a4j:commandLink within table
                    John Who Newbie

                     

                    "ilya_shaikovsky" wrote:
                    pelase check 3.3.1GA. there were such issues previously.. should works under latest GA.


                    thanks for that hint.
                    I will try this...

                    • 8. Re: Problem with a4j:commandLink within table
                      John Who Newbie

                      The change to 3.3.1 GA doesn't have any effect :(

                      Does anybody implements such a scenario?
                      Would be really thankfull for a code example. Doesn't have any ideas left...

                      • 9. Re: Problem with a4j:commandLink within table
                        Ilya Shaikovsky Master

                        add phaseTracker to application and check it's output for unsuccessful request.

                        • 10. Re: Problem with a4j:commandLink within table
                          John Who Newbie

                           

                          "hrbaer" wrote:
                          The change to 3.3.1 GA doesn't have any effect :(

                          Does anybody implements such a scenario?
                          Would be really thankfull for a code example. Doesn't have any ideas left...


                          I have to relativize this statement.
                          In adddition to the newest jar-files for richfaces (3.3.1.GA) I although had the older ones in my war-file. After removing them I'm getting this error:

                          java.lang.ClassCastException: org.richfaces.model.ScrollableTableDataRange
                           at org.ajax4jsf.model.SequenceDataModel.walk(SequenceDataModel.java:84)
                           at org.ajax4jsf.component.UIDataAdaptor.walk(UIDataAdaptor.java:1127)
                           at org.richfaces.component.UIScrollableDataTable.walk(UIScrollableDataTable.java:413)
                           at org.richfaces.renderkit.html.ScrollableDataTableBaseRenderer.renderGridBody(ScrollableDataTableBaseRenderer.java:555)
                           at org.richfaces.renderkit.html.ScrollableDataTableRenderer.doEncodeEnd(ScrollableDataTableRenderer.java:405)
                           at org.richfaces.renderkit.html.ScrollableDataTableRenderer.doEncodeEnd(ScrollableDataTableRenderer.java:606)
                           at org.ajax4jsf.renderkit.RendererBase.encodeEnd(RendererBase.java:135)
                           at org.richfaces.renderkit.html.ScrollableDataTableBaseRenderer.encodeEnd(ScrollableDataTableBaseRenderer.java:879)
                           at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:847)


                          In my lib-direcotry there is now only the following libs (related to richfaces):
                          richfaces-api-3.3.1.GA.jar
                          richfaces-impl-3.3.1.GA.jar
                          richfaces-ui-3.3.1.GA.jar

                          (When I use 3.3.0.GA there are no effects.)

                          • 11. Re: Problem with a4j:commandLink within table
                            John Who Newbie

                             

                            "ilya_shaikovsky" wrote:
                            add phaseTracker to application and check it's output for unsuccessful request.


                            No differences beetween the link within the table and the link after the table.
                            Output for the table-link:
                            29.06.2009 14:54:15 org.exadel.jsf.PhaseTracker beforePhase
                            INFO: BEFORE RESTORE_VIEW 1
                            29.06.2009 14:54:15 org.exadel.jsf.PhaseTracker afterPhase
                            INFO: AFTER RESTORE_VIEW 1
                            29.06.2009 14:54:15 org.exadel.jsf.PhaseTracker beforePhase
                            INFO: BEFORE APPLY_REQUEST_VALUES 2
                            29.06.2009 14:54:15 org.exadel.jsf.PhaseTracker afterPhase
                            INFO: AFTER APPLY_REQUEST_VALUES 2
                            29.06.2009 14:54:15 org.exadel.jsf.PhaseTracker beforePhase
                            INFO: BEFORE PROCESS_VALIDATIONS 3
                            29.06.2009 14:54:15 org.exadel.jsf.PhaseTracker afterPhase
                            INFO: AFTER PROCESS_VALIDATIONS 3
                            29.06.2009 14:54:15 org.exadel.jsf.PhaseTracker beforePhase
                            INFO: BEFORE UPDATE_MODEL_VALUES 4
                            29.06.2009 14:54:15 org.exadel.jsf.PhaseTracker afterPhase
                            INFO: AFTER UPDATE_MODEL_VALUES 4
                            29.06.2009 14:54:15 org.exadel.jsf.PhaseTracker beforePhase
                            INFO: BEFORE INVOKE_APPLICATION 5
                            29.06.2009 14:54:15 org.exadel.jsf.PhaseTracker afterPhase
                            INFO: AFTER INVOKE_APPLICATION 5
                            29.06.2009 14:54:15 org.exadel.jsf.PhaseTracker beforePhase
                            INFO: BEFORE RENDER_RESPONSE 6
                            29.06.2009 14:54:16 org.exadel.jsf.PhaseTracker afterPhase
                            INFO: AFTER RENDER_RESPONSE 6


                            Output for the link after the table:
                            29.06.2009 14:54:57 org.exadel.jsf.PhaseTracker beforePhase
                            INFO: BEFORE RESTORE_VIEW 1
                            29.06.2009 14:54:57 org.exadel.jsf.PhaseTracker afterPhase
                            INFO: AFTER RESTORE_VIEW 1
                            29.06.2009 14:54:57 org.exadel.jsf.PhaseTracker beforePhase
                            INFO: BEFORE APPLY_REQUEST_VALUES 2
                            29.06.2009 14:54:57 org.exadel.jsf.PhaseTracker afterPhase
                            INFO: AFTER APPLY_REQUEST_VALUES 2
                            29.06.2009 14:54:57 org.exadel.jsf.PhaseTracker beforePhase
                            INFO: BEFORE PROCESS_VALIDATIONS 3
                            29.06.2009 14:54:57 org.exadel.jsf.PhaseTracker afterPhase
                            INFO: AFTER PROCESS_VALIDATIONS 3
                            29.06.2009 14:54:57 org.exadel.jsf.PhaseTracker beforePhase
                            INFO: BEFORE UPDATE_MODEL_VALUES 4
                            29.06.2009 14:54:57 org.exadel.jsf.PhaseTracker afterPhase
                            INFO: AFTER UPDATE_MODEL_VALUES 4
                            29.06.2009 14:54:57 org.exadel.jsf.PhaseTracker beforePhase
                            INFO: BEFORE INVOKE_APPLICATION 5
                            29.06.2009 14:54:57 org.exadel.jsf.PhaseTracker afterPhase
                            INFO: AFTER INVOKE_APPLICATION 5
                            29.06.2009 14:54:57 org.exadel.jsf.PhaseTracker beforePhase
                            INFO: BEFORE RENDER_RESPONSE 6
                            29.06.2009 14:54:57 org.exadel.jsf.PhaseTracker afterPhase
                            INFO: AFTER RENDER_RESPONSE 6


                            • 12. Re: Problem with a4j:commandLink within table
                              John Who Newbie

                              OK, now its getting realy strange.

                              I replaced all the ajax-functions by normal h:commandLinks/h:commandButtons. But instead reaching my method in the managed bean when using a link nothin happens!

                              So this is the "rest" of my code:

                              <rich:scrollableDataTable value="#{mb.liste}" var="list" width="70%" height="100px" id="liste">
                               <rich:column>
                               <f:facet name="header"><h:outputText styleClass="headerText" value="Name" /></f:facet>
                               <h:commandLink actionListener="'#{mb.showDetails}" value="Detail" />
                               </rich:column>
                              </rich:scrollableDataTable>
                              <h:panelGrid columns="1" width="70%" border="0" cellspacing="0" cellpadding="0" columnClasses="alignRight">
                               <h:commandLink actionListener="#{mb.showDetails}" value="Detail" />
                              </h:panelGrid>
                              


                              So the link in the table doesn't have any effect but the same(!) link after the table does work!!

                              Does anybody has another idea?
                              Is it a problem with the rich:scrollableDataTable-tag? Are there any known problems with this tag? Or does anybody used it already with a link in it??

                              • 13. Re: Problem with a4j:commandLink within table
                                John Who Newbie

                                 

                                "hrbaer" wrote:

                                Does anybody has another idea?
                                Is it a problem with the rich:scrollableDataTable-tag? Are there any known problems with this tag? Or does anybody used it already with a link in it??


                                Indeed it's a problem with the rich:scrollableDataTable-tag!
                                The same code just replaced by rich:dataTable does work.

                                DOES NOT WORK:
                                <rich:scrollableDataTable value="#{mb.liste}" var="list" width="70%" height="100px" id="liste">
                                 <rich:column>
                                 <f:facet name="header"><h:outputText styleClass="headerText" value="Name" /></f:facet>
                                 <h:commandLink actionListener="'#{mb.showDetails}" value="Detail" />
                                 </rich:column>
                                </rich:scrollableDataTable>
                                


                                DOES WORK:
                                <rich:dataTable cellpadding="0" cellspacing="0" width="70%" id="liste2" border="0" var="record" value="#{mb.liste}">
                                 <rich:column>
                                 <f:facet name="header"><h:outputText styleClass="headerText" value="Name" /></f:facet>
                                 <h:commandLink actionListener="'#{mb.showDetails}" value="Detail" />
                                 </rich:column>
                                </rich:scrollableDataTable>
                                


                                ...I don't know what to do :(