ui:repeat JSF 2.0无法渲染迭代的p:row primefaces [英] ui:repeat JSF 2.0 cannot render iterate p:row primefaces

查看:92
本文介绍了ui:repeat JSF 2.0无法渲染迭代的p:row primefaces的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里遇到问题,我的系统配置是Mojarra 2.1.7,Primefaces 3.2和使用Glassfish 3.1+.

I got a problem here, my system config was Mojarra 2.1.7, Primefaces 3.2 and using Glassfish 3.1+.

在此之前,我使用以下代码很好地呈现了我的代码:

before this, i got my code well rendered using this codes:

<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>  

,我发现这会生成相当难看的接口,所以我从素面中碰到了p:panelGrid.
在我写了一些代码之后,并从我的期望中可以使用,但是它不:(
该代码完美地呈现了标头,但是紧随ui:repeat代码之后,它不会呈现其中的p:rowp:column.

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>  

我想念东西吗?.
还是那是个bug ..?因为我在google上搜索了这种代码,却一无所获.
问候,
bLueZ

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建议我发布答案.

Thanks to @Jedrus07 to suggest me to post an answer.

实际上,我所做的就是使用<p:dataTable/>很好地显示数据. 例子:

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>

因此,请使用datatable获得更好的外观以显示您的数据:) 玩得开心.

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

这篇关于ui:repeat JSF 2.0无法渲染迭代的p:row primefaces的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆