English 中文(简体)
ui:repeat JSF 2. 0 无法使变速 p: row prickfaces
原标题:ui:repeat JSF 2.0 cannot render iterate p:row primefaces

我有一个问题,我的系统配置是Mojarra 2.1.7, 正面3.2, 使用玻璃鱼3.1+。

在这之前,我用这个代码 完成了我的代码:

<p:tabView>
    <p:tab title="Offices Access" >
         <h:outputText value="Access | Offices Name | Offices Code | Parent Offices" style="font-weight: bold;"/>

         <ui:repeat value="#{userBean.officeses}" var="office">
              <h:panelGrid columns="2">
                   <p:selectBooleanCheckbox id="access#{office.officesID}" style="width: 50px;"/>
                   <h:outputLabel for="access#{office.officesID}" value="#{office.officesName} | #{office.officesCode} | #{office.parentOffices}"/>
               </h:panelGrid>
         </ui:repeat>
     </p:tab>
</p:tabView>  

and i find this is generate rather ugly interfaces, so i ran over p:panelGrid from primefaces.
after i write some code and from my expectation it would work, but it DONT :(
this code render the header perfectly, but right after the ui:repeat code, it wouldnt render the p:row and the p:column inside it.

以下是代码:

<p:tabView>
    <p:tab title="Offices Access" >
        <p:panelGrid styleClass="centerContent">
             <f:facet name="header">
                 <p:row>
                     <p:column style="font-weight: bold;">Access</p:column>
                     <p:column style="font-weight: bold;">Offices Name</p:column>
                     <p:column style="font-weight: bold;">Offices Code</p:column>
                     <p:column style="font-weight: bold;">Above Level Offices</p:column>
                 </p:row>
            </f:facet>

            <ui:repeat value="#{userBean.officeses}" var="office">
                <p:row id="rowforOffice#{office.officesID}">
                    <p:column><p:selectBooleanCheckbox id="access#{office.officesID}"/></p:column>
                    <p:column><h:outputText value="#{office.officesName}"/></p:column>
                    <p:column><h:outputText value="#{office.officesCode}"/></p:column>
                    <p:column><h:outputText value="#{office.parentOffices}"/></p:column>
                </p:row>
            </ui:repeat>
       </p:panelGrid>
    </p:tab>
</p:tabView>  

am i miss something..?
or it is was a bug..? because i ran over google looking for this kind of code and i found nothing.
Regards,
bLueZ

最佳回答

感谢@Jedrus07建议我发表答覆。

Actually, what i did, was using <p:dataTable/> to make a good display of data. example :

<p:tabView id="tabCustomerView">
    <p:tab title="Fasilitas Nasabah">
                <p:fieldset legend="Detil Fasilitas">
                    <p:dataTable value="#{custViewBean.customerSavingAccounts}"
                                 var="customerSavingAccount"
                                 rowIndexVar="customerSavingAccountRowIndex"
                                 paginator="true"
                                 paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                                 rows="10"
                                 rowsPerPageTemplate="5,10,15"
                                 paginatorPosition="top">
                        <f:facet name="header">
                            <h:outputText value="Daftar Rekening / Fasilitas Nasabah"/>
                        </f:facet>

                        <p:column headerText="#">
                            <h:outputText value="#{customerSavingAccountRowIndex + 1}"/>
                        </p:column>

                        <p:column headerText="Fasilitas Nasabah">
                            <h:outputText value="#{of:capitalize(customerSavingAccount.customerFacility)}"/>
                        </p:column>

                        <p:column headerText="Saldo Akhir">
                            <h:outputText value="#{customerSavingAccount.lastBalance}">
                                <f:convertNumber type="currency" currencySymbol="#{appBean.appSetting.curDefault.currencySymbol}"/>
                            </h:outputText>
                        </p:column>

                        <p:column headerText="Tanggal Akhir">
                            <h:outputText value="#{customerSavingAccount.lastTransactiondate}">
                                <f:convertDateTime pattern="#{appBean.appSetting.siteFormatdate}"/>
                            </h:outputText>
                        </p:column>

                        <p:column headerText="Suku Bunga">
                            <h:outputText value="#{customerSavingAccount.interest} %"/>
                        </p:column>

                        <p:column headerText="Kolektibilitas">
                            <h:outputText value="#{customerSavingAccount.collectibility}"/>
                        </p:column>

                        <p:column headerText="Account Officer">
                            <h:outputText value="#{of:capitalize(customerSavingAccount.accountOfficer)}"/>
                        </p:column>

                        <p:column headerText="Jumlah Tunggakan">
                            <h:outputText value="#{customerSavingAccount.arrearsAmount}">
                                <f:convertNumber type="currency" currencySymbol="#{appBean.appSetting.curDefault.currencySymbol}"/>
                            </h:outputText>
                        </p:column>

                        <p:column headerText="Jumlah Pembayaran">
                            <h:outputText value="#{customerSavingAccount.totalPayment}">
                                <f:convertNumber type="currency" currencySymbol="#{appBean.appSetting.curDefault.currencySymbol}"/>
                            </h:outputText>
                        </p:column>

                        <p:column headerText="Periode Pembayaran">
                            <h:outputText value="#{customerSavingAccount.termLimit} #{customerSavingAccount.termLimitDesc}"/>
                        </p:column>

                        <p:column headerText="Status">
                            <h:outputText value="#{customerSavingAccount.status}"/>
                        </p:column>
                    </p:dataTable>
                </p:fieldset>
            </p:tab>
</p:tabView>

So, use datatable for nicer looks to display your datas :) Have fun.

问题回答

至于具体的问题, 是一个显示时间标记的视图。 因此, 它在 JSF 组件树中存在, 并产生其 HTML 输出, 需要多少倍于该值的循环 。

然而, 期望物理上的多重 child; child; 中有一个单一个 。 换句话说, 它们需要在视图构建时间而不是视图转换时间进行准备 。

JSTL 是一个视图构建时间标记。 它会在 JSF 组件树中产生物理多重 组件, 因此, 将只找到 子元素 。

<p:panelGrid styleClass="centerContent">
    <c:forEach items="#{userBean.officeses}" var="office">
        <p:row id="rowforOffice#{office.officesID}">
            <p:column><p:selectBooleanCheckbox id="access#{office.officesID}"/></p:column>
            <p:column><h:outputText value="#{office.officesName}"/></p:column>
            <p:column><h:outputText value="#{office.officesCode}"/></p:column>
            <p:column><h:outputText value="#{office.parentOffices}"/></p:column>
        </p:row>
    </c:forEach>
</p:panelGrid>

注意 : 这个断开视图, 以大于 2. 1. 18 的 Mojarra 版本覆盖豆类 。 如果您不能升级, 请考虑 < code\ lt; p: data Table> , 正如您已经发现的那样 。

See also:





相关问题
problem with primefaces library (jsf)

i am new to primeface. i have tried to test an example of primefaces about tag as in its documentation, this is my jsf page code: <%@ page language="java" import="java.util.*" pageEncoding="...

Loading a set of images with primefaces

I have the next code to load a set of images whose streams are in a datamodel called names. My problem is when I declare the var inside the p:datatable tag seems like has nothing. Any idea? thx! <...

Primefaces Tree set checkboxes

I have a JSF application using Primefaces. I use the multiselect tree component which includes a checkbox on each tree node. My problem is that I need to preselect the tree nodes with values coming ...

Primefaces p:fileupload component problem

I am using Primefaces 2.0.1 but the FileUpload component is not working properly. It uses JQuery uploadify behind the scenes. This is my web.xml <?xml version="1.0" encoding="UTF-8"?> <web-...

热门标签