7

我想显示一个这样的蒙面数字:1.234.567,89。以下代码已经这样做了:

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

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

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

提前致谢。

4

3 回答 3

15

您可以尝试使用f:facet放置您的 footerText 。这是我以前将它用于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

更新

以下是标题类型中标题方面的工作原理:

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

对于页脚类型中的页脚方面:

<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> 
于 2013-11-05T16:00:38.447 回答
0

You can do thay by using ui param and use converter in it. After that getting that value at p:column footerText

于 2013-11-05T19:00:23.927 回答
0

如果您可以使用Omnifaces,那么您可以

<p:columnGroup type="footer">
  <p:row>
    <p:column colspan="3" footerText="Total:" />
    <p:column footerText="#{of:formatNumber(bean.total.jan, '#.00')}" />
    <p:column footerText="#{of:formatNumber(bean.total.feb, '#.00')}" />
    <p:column footerText="#{of:formatNumber(bean.total.mar, '#.00')}" />
    <p:column footerText="#{of:formatNumber(bean.total.apr, '#.00')}" />
    <p:column footerText="#{of:formatNumber(bean.total.may, '#.00')}" />
    <p:column footerText="#{of:formatNumber(bean.total.jun, '#.00')}" />
    <p:column footerText="#{of:formatNumber(bean.total.jul, '#.00')}" />
    <p:column footerText="#{of:formatNumber(bean.total.aug, '#.00')}" />
    <p:column footerText="#{of:formatNumber(bean.total.sep, '#.00')}" />
    <p:column footerText="#{of:formatNumber(bean.total.oct, '#.00')}" />
    <p:column footerText="#{of:formatNumber(bean.total.nov, '#.00')}" />
    <p:column footerText="#{of:formatNumber(bean.total.dec, '#.00')}" />
  </p:row>
</p:columnGroup>
于 2015-12-04T15:40:09.417 回答