简体   繁体   English

ui 重复 p:panelGrid 和其他 ui 在素面内重复

[英]ui repeat with p:panelGrid and other ui repeat inside primefaces

I have a problem trying using ui repeat with a datagrid and other ui repeat inside this grid我在尝试使用带有数据网格的 ui repeat 和此网格内的其他 ui repeat 时遇到问题

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.第二个 uirepeat 的值未显示。

ui:repeat runs during view render time, while p:panelGrid runs during view build time. ui:repeat 在视图渲染期间运行,而 p:panelGrid 在视图构建期间运行。 PanelGrid will expect their child elements during the view build time, but since they will be available at render time, it fails. PanelGrid 将在视图构建期间期待它们的子元素,但由于它们在渲染时可用,因此失败。

Try this on the second ui:repeat.在第二个 ui:repeat 上试试这个。 Change ui:repeat with c:forEach更改 ui:repeat 与 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(eg p:panelgrid) inside ui:repeat您也可以在此处使用 BalusC 的帖子: c:forEach inside primefaces(eg 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}.另一方面,因为你有一个 3 列的布局,你不能在 #{blockSpace.blockSpaceCabin} 里面有两个以上的元素,所以你可以在第一个 forEach 中定义的 blockSpace 元素上将它们设置为 #{providersMB.fillBlockSpaceRsv }. Best not mix jstl tags with jsf's for the peace of mind.最好不要将 jstl 标签与 jsf 混合使用,以免麻烦。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM