本文介绍了PrimeFaces footerText列Datatable中的掩盖数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要显示这样一个带掩码的数字:1.234.567,89.下面的代码已经做到了:

I want to display a masked number like this: 1.234.567,89.The following code already do this:

<p:column>
    <h:outputText value="#{item.value}">
      <f:convertNumber locale="pt_BR"/>
    </h:outputText>
</p:column>

如何在footerText列中为Primefaces数据表应用相同的掩码,如以下代码摘录?

How can I applly the same mask for a Primefaces datatable in a footerText column as the following code excerpt?

<p:columnGroup type="footer">  
  <p:row>  
    <p:column colspan="8" footerText="Grand Total:" />  
    <p:column footerText="#{upbController.totalLosses}" />      
  </p:row>  
</p:columnGroup>

谢谢.

推荐答案

您可以尝试使用 f:facet 放置footerText.这是我过去用于 p:column

You can try to place your footerText using f:facet. Here is how I used to use it for p:column:

<p:column headerText="Number of units" >
    <h:outputText value="#{item.units}" />
    <f:facet name="footer">
        <h:outputText
            value="Total: #{mybean.unitsTotal}" />
        <br />
        <h:outputText
            value="To do: #{mybean.unitsTodo}" />

    </f:facet>
</p:column>

我怀疑它对 p:columnGroup 也适用,然后您可以将 f:convertNumber 应用于这样的 h:outputText .

I suspect that it would work also for p:columnGroup and then you can apply f:convertNumber to such h:outputText.

这是标题类型中标题面的工作方式:

And here's how works for header facet in header type:

<p:columnGroup type="header">
    <p:row>
        <p:column rowspan="2" headerText="Manufacturer" />
        <p:column colspan="2">
            <f:facet name="header">
                <h:outputText value="#{bean.countValue(bean.order)}">
                    <f:convertNumber maxFractionDigits="2" minFractionDigits="2" currencyCode="PLN" locale="pl_PL" />
                </h:outputText>
            </f:facet>
        </p:column>
    </p:row>
</p:columnGroup>

,并且对于页脚类型中的页脚构面:

and for footer facet in footer type:

<p:columnGroup rendered="true" type="footer">
    <p:row>
        <p:column rowspan="2" headerText="Manufacturer" />
        <p:column colspan="2">
            <f:facet name="footer">
                <h:outputText value="#{bean.countPieces(bean.order)}">
                    <f:convertNumber pattern="###,###.00" locale="pl_PL"/>
                </h:outputText>
            </f:facet>
        </p:column>
    </p:row>
</p:columnGroup> 

这篇关于PrimeFaces footerText列Datatable中的掩盖数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 13:42