10 Replies Latest reply on Oct 5, 2007 5:08 PM by sergeysmirnov

    rich:taba and a4j:repeat don't seem to work together...

    tb01923

      I would like an arbitrary number of tabs, yet the only one that seems to display is the default one. I know the a4j:repeat is working, because takign it out of the tab context renders me a a hand full of tables. em:table and em:column are wrappers around rich:dataTable and richColumn. Any help is greatly appreciated...


      <rich:tabPanel switchType="client">
       <rich:tab label="#{masterBean.chartTitle}">
       <a4j:outputPanel layout="block" style="margin-top: 10px">
       <em:table id="myData" propertyBean="${masterBean.somTable}" property="data"
       class="listTable2" cellspacing="1" cellpadding="1" width="100%" paginate="true" rowClasses="Odd, Even" >
       <em:column cellProperty="benchmarkName" headerClass="estimateHeader"
       title="Benchmark" />
       <em:column cellProperty="deviation" headerClass="estimateHeader"
       title="Deviation" type="java.lang.Float" minFraction="2" maxFraction="2" />
       <em:column cellProperty="spread" headerClass="estimateHeader"
       title="Spread" type="java.lang.Float" minFraction="2" maxFraction="2" />
       <em:column cellProperty="performance" headerClass="estimateHeader"
       title="Performance" type="java.lang.Float" minFraction="2" maxFraction="2" />
       <em:column cellProperty="performanceBPT" headerClass="estimateHeader"
       title="Performance BPT" type="java.lang.Float" minFraction="2" maxFraction="2" />
       </em:table>
       </a4j:outputPanel>
       </rich:tab>
       <a4j:repeat value="${masterBean.subBeans}" var="myBean">
       <rich:tab label="#{myBean.chartTitle}">
       <em:table propertyBean="${myBean.somTable}" property="data"
       class="listTable2" cellspacing="1" cellpadding="1" width="100%" paginate="true" rowClasses="Odd, Even" >
       <em:column cellProperty="benchmarkName" headerClass="estimateHeader"
       title="Benchmark" />
       <em:column cellProperty="deviation" headerClass="estimateHeader"
       title="Deviation" type="java.lang.Float" minFraction="2" maxFraction="2" />
       <em:column cellProperty="spread" headerClass="estimateHeader"
       title="Spread" type="java.lang.Float" minFraction="2" maxFraction="2" />
       <em:column cellProperty="performance" headerClass="estimateHeader"
       title="Performance" type="java.lang.Float" minFraction="2" maxFraction="2" />
       <em:column cellProperty="performanceBPT" headerClass="estimateHeader"
       title="Performance BPT" type="java.lang.Float" minFraction="2" maxFraction="2" />
       </em:table>
       </rich:tab>
       </a4j:repeat>
      
       </rich:tabPanel>


        • 1. Re: rich:taba and a4j:repeat don't seem to work together...

          It is known bug.
          You can use c:forEach if you use facelets.

          • 2. Re: rich:taba and a4j:repeat don't seem to work together...
            tb01923

            Is this c:forEach (jstl) or ui:repeat?

            neither seem to be effective for me.

            • 3. Re: rich:taba and a4j:repeat don't seem to work together...

               

              "AlexanderBelov" wrote:
              It is known bug.
              You can use c:forEach if you use facelets.


              It is not a bug.

              • 4. Re: rich:taba and a4j:repeat don't seem to work together...
                tb01923

                Could you please explain a little more detail. If this is not a bug...

                is it intended that the rich:tab and a4j:repeat do not work together?

                or should they work together and I am doing somthing hopelessly wrong?

                I Tried it in the simplest sense by removing the table and just iterating over the collection outputing tabs that contained junk. I am fairly certain its not the table causing the issue.

                I am only seeing the single default view of the one tab on its own. The tabs which should be output from within the repeat do not output.

                Thank you for clarifying.

                Todd

                • 5. Re: rich:taba and a4j:repeat don't seem to work together...

                  Use c:forEach of JSTL. I don't know another c:forEach. It works in facelets, but doesn't work in JSP.
                  Namespace: xmlns:c="http://java.sun.com/jstl/core".

                  • 6. Re: rich:taba and a4j:repeat don't seem to work together...

                     

                    It is not a bug.


                    People see the only description in documentation:

                    The <a4j:repeat> component implements a basic iteration component allowing to update a set of its children with AJAX.


                    They don't have another source of information. What they have to think? Isn't it a bug, that component doesn't make its work?
                    I know, that it is not a bug. But you should explain it in documentation, tell people more about components. Forum is too large already to quickly find necessary information.

                    • 7. Re: rich:taba and a4j:repeat don't seem to work together...

                      JSF Spec is the true source for information about basic of JSF.

                      Did you try to add children to the h:panelGrid (when columns greater than 1) with ui:repeat? The same question, but about c:forEach. What is the difference? How you can explain it from the JSF point of view?

                      • 8. Re: rich:taba and a4j:repeat don't seem to work together...

                        Of cource, if you want... a4j:repeat and ui:repeat - the only component inside h:panelGrid. For example, we have 2 columns in panelGrid and trying to iterate 6 times. It we shall use c:forEach, we shall have 2 columns, 3 rows. If we shall use other iterable component, there will be 1 column, 6 rows.

                        Right?

                        So, what do you think about including it in documentation? Because people wait right work, described in documentation. And everyone have to find workaround then it doen't work as described.

                        • 9. Re: rich:taba and a4j:repeat don't seem to work together...

                          Besides, I think you can make workaround for component of your library? ui:repeat cannot be used in JSP. It would be great to have component, which will work good in both ways. Component, which will work better then c:forEach (I mean situation of using c:forEach to iterate tabs inside tabPanel in JSP, for example. It doen't work yet, does it?).

                          And thank you for your good work.

                          • 10. Re: rich:taba and a4j:repeat don't seem to work together...

                             

                            "AlexanderBelov" wrote:
                            Of cource, if you want... a4j:repeat and ui:repeat - the only component inside h:panelGrid. For example, we have 2 columns in panelGrid and trying to iterate 6 times. It we shall use c:forEach, we shall have 2 columns, 3 rows. If we shall use other iterable component, there will be 1 column, 6 rows.

                            Right?

                            So, what do you think about including it in documentation? Because people wait right work, described in documentation. And everyone have to find workaround then it doen't work as described.


                            To document what? To document that a4j:repeat is a JSF component and cannot used like it is not?

                            You forgot to answer the very important question: Why? Why it is the difference?
                            Ok, I will answer:
                            ui:repeat (as well as a4j:repeat) is a JSF component
                            c:forEach is not a JSF component at all.

                            When you add ui:repeat to the h:panelGrid, the panelGrid has only one child - ui:repeat. All six children of ui:repeat are grandchildren for panelGrid. panelGrid has no idea that you mean you want to put grandchildren to the table cell. panelGrid is developed to put its own children there. It has only one child. So, it does its job quite right.

                            rich:tabPanel expects to see rich:tabs as children. ui:repeat as a child is not tasted good for it.