0

I have a loop that contains a list of properties I would like to display this list on 2 columns, but I can not.   they are displayed by unordered, against if I use c: For Each place of ui: repeat the problem is resolved

<p:panel id="panlecart2" header ="Caracteristique selon la categorie" toggleable="true" rendered="true" style="width=900px;">            
            <h:panelGrid  id="panlecart" columns="2" cellpadding="5" rendered="true" style="width=900px;">                         
            <ui:repeat var="var1" value="#{composantbean.categorie.proprietes.toArray()}">            
            <h:outputText value="#{var1.nomProp }(#{var1.unite}  )"  />
            <h:inputText value="" />  

            </ui:repeat>             
         </h:panelGrid>
          </p:panel>   

Haw can I fixe the problem .helpe please :)

FERESSS
  • 137
  • 1
  • 5
  • 14

2 Answers2

1

ui:repeat is rendered in a later phase than c:forEach. Here's an explanation.

c:forEach is the way to go here, since this is invoked in view build time.

ui:repeat is invoked during view render time, so p:panel would have no knowledge of the data being created by ui:repeat.

Roger Keays
  • 3,117
  • 1
  • 31
  • 23
Menno
  • 12,175
  • 14
  • 56
  • 88
1

You could switch to using <h:dataTable> to iterate over the components:

<h:dataTable var="var1" value="#{composantbean.categorie.proprietes.toArray()}">
    <h:column>
        <h:outputText value="#{var1.nomProp }(#{var1.unite}  )"  />
    </h:column>
    <h:column>
        <h:inputText value="" />  
    </h:column>
</h:dataTable>

Enclose it within a <p:panel> to make it work. Otherwise, make use of <c:forEach> as it's a good fit for your use case.

skuntsel
  • 11,624
  • 11
  • 44
  • 67