I would like to set currency format in Primefaces column group without getting string (with currency format) value form JSF Backing Bean.
If there is no way to set currency format in the page, I will take string value with currency format as below.
public String getCurrencyFormatString(Double value) {
DecimalFormat formatter = new DecimalFormat("##,###.00");
return formatter.format(value);
}
<p:dataTable id="paymentDataTable" var="payment" value="#{PaymentActionBean.paymentList}">
<!--Other six columns-->
<p:column headerText="Total">
<h:outputText value="#{payment.totalAmount}">
<f:convertNumber pattern="#{ApplicationSetting.currencyFormat}"/>
</h:outputText>
</p:column>
<p:columnGroup type="footer">
<p:row>
<p:column colspan="7" footerText="Total:" style="text-align:right"/>
<p:column footerText="#{PaymentActionBean.grandTotalAmount}" style="text-align:right">
<!--How Can I put number format (##,###.00) for grand total amount? -->
</p:column>
</p:row>
</p:columnGroup>
<p:dataTable>
Don't use footerText. Instead:
<p:columnGroup type="footer">
<p:row>
<p:column colspan="7" footerText="Total:" style="text-align:right"/>
<p:column style="text-align:right">
<f:facet name="footer">
<h:outputText value="#{PaymentActionBean.grandTotalAmount}">
<f:convertNumber pattern="##,###.00" />
</h:outputText>
</f:facet>
</p:column>
</p:row>
</p:columnGroup>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With