1

Related to the question Display formatted decimal numbers in Primefaces 4, how can I display - in a PrimeFaces datatable - a number masked like this:

1.987.654,32

The original data, which are read from a float column in SQLServer database table, is (e.g.):

1987654.32

I've tried the code below, but no success:

<p:column sortBy="#{item.value}" filterBy="#{item.value}">
  <f:facet name="header">
    <h:outputText value="#{epoBundle.ListUpbTitle_value}"/>
  </f:facet>
    <h:outputText value="#{item.value}">
      <f:convertNumber pattern="#0.000" locale="pt_BR"/>
    </h:outputText>
</p:column>    

Thanks in advance.

Community
  • 1
  • 1
jMarcel
  • 958
  • 5
  • 24
  • 54

1 Answers1

1

The correct pattern for the <f:convertNumber .../> you want is: ###,###.000. You can read more about decimal formatting here: http://docs.oracle.com/javase/tutorial/i18n/format/decimalFormat.html

Bonus: for different masks, you can use other locales: https://stackoverflow.com/a/11836387/1362049

Community
  • 1
  • 1
Simon Arsenault
  • 1,777
  • 17
  • 35