1

I have already successfully displayed a dynamic datatable (dynamic columns and rows) in my jsf page.

However, i need to display more than 1 table - vertically. How do I iterate in my list in order to display them?

thanks

Theres

2 Answers 2

1

How about

    <ul>
        <ui:repeat value="#{someBean.items}" var="someCurrentItems">
            <li>
                <h:dataTable value="#{someCurrentItems}" var="currentItem"></h:dataTable>
            </li>
        </ui:repeat>
    </ul>   

And if you want to get rid of the bulletins add this to your css file (you can give a more precise selector to the css if you will wrap the ul with some div with id...)

ul { list-style-type: none; }

Sign up to request clarification or add additional context in comments.

6 Comments

Be careful, using UIData inside UIRepeat has some peculiar bugs in Mojarra.
@BalusC Ok, havent tried it myself... Is <c:forEach better in this specific case?
c:forEach is useful only if the model won't change on the same view because it's evaluated at view creation time.
it did not work :-( somehow the datatable inside the ui:repeat generates the same IDs probably the reason why it is not working.
what error msgs are you getting ? an unique id should be generated by the JSF (or a unique prefix/sufix in case you set your own id)
|
0

Another example with more details:

<ul>
             <ui:repeat value="#{timeslipBean.usersSlips}" var="tabSlips" >
            <li>
             <p:dataTable id="timeslips" var="time" value="#{tabSlips.table}">
             <h2>
                 #{tabSlips.label} 
            </h2>                    
                  <p:column >
                   <f:facet name="header" >  
                               User  
                   </f:facet>  
                        <h:outputText value="#{time.user}"/>
                  </p:column>
                  <p:columns value="#{tabSlips.columns}" var="column" columnIndexVar="colIndex" styleClass="#{time.times[colIndex].festivo ? 'festivo' : null}">  
                         <f:facet name="header">  
                               #{column.header}  
                        </f:facet>  
                        <h:outputText value="#{time.times[colIndex].hours}" styleClass="#{time.times[colIndex].style}"/>
                   </p:columns> 
              </p:dataTable>    
            </li>
        </ui:repeat>
    </ul>   

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.