-2

I have a problem trying using ui repeat with a datagrid and other ui repeat inside this grid

This is my code

<ui:repeat var="blockSpace" value="#{providersMB.fillBlockSpaceRsv}" >
<p:panelGrid style="margin-top:20px" rendered="#{providersMB.blockSpace}">
    <f:facet name="header">                     
        <p:row>
            <p:column>
                <h:outputLabel value="#{blockSpace.company}" />                                     
           </p:column>
           <p:column>#{label['displayOrders.label.businessClass']}/p:column>
           <p:column>#{label['displayOrders.label.yankeeClass']}</p:column>                                                         
        </p:row>                 
    </f:facet>

    <p:row>
        <p:column>#{label['displayOrders.label.reservation']}</p:column>                         
        <p:column><p:spinner id="basic" value="#{spinnerView.number1}" />
        </p:column>                      
        <p:column>
        <p:spinner id="spinner" value="#{spinnerView.number1}" />
        </p:column>

    </p:row>

    <p:row>
        <p:column>#{label['displayOrders.label.configuration']}</p:column>
        <ui:repeat var="blockSpaceCabin" 
             value="#{blockSpace.blockSpaceCabin}" >
           <p:column> <h:outputLabel value="#{blockSpaceCabin.quantity}"/>                     
           </p:column>
        </ui:repeat>                                            
    </p:row>                       
</p:panelGrid>

the values of the second uirepeat not show.

1 Answers1

0

ui:repeat runs during view render time, while p:panelGrid runs during view build time. PanelGrid will expect their child elements during the view build time, but since they will be available at render time, it fails.

Try this on the second ui:repeat. Change ui:repeat with c:forEach

<c:forEach items="#{blockSpace.blockSpaceCabin}" var="blockSpaceCabin">
    <p:column>
        <h:outputLabel value="#{blockSpaceCabin.quantity}"/>                     
    </p:column>
</c:forEach>

You can make use of BalusC's post here also: c:forEach inside primefaces(e.g. p:panelgrid) inside ui:repeat

On the other hand, since you have a 3-column layout, you cannot have more then two elements inside #{blockSpace.blockSpaceCabin}, so you may well set them on the blockSpace elements defined in the first forEach as #{providersMB.fillBlockSpaceRsv}. Best not mix jstl tags with jsf's for the peace of mind.

Community
  • 1
  • 1
Emre Türkiş
  • 992
  • 9
  • 23