Display Decimal

2013-06-02
2013-06-04
  • Medasha Govender

    Hi,

    I have a field that contains a percentage. I have defined it as follows:

    @Digits(integerDigits=2, fractionalDigits=2)
    @Column(name="interest")
    private BigDecimal interest;

    I enter 10.00 and the field shows as 10.00. However, if I click on the row from the list mode the field displays as 10. I would like it to display as 10.00.

    Is there any way to do this ?

    Thanks in advance.

    Med

     
  • Javier Paniza

    Javier Paniza - 2013-06-04

    Hi Med,

    in order to solve your problem fast just annotate your property as MONEY:

    @Digits(integerDigits=2, fractionalDigits=2)
    @Column(name="interest")
    @Stereotype("MONEY")
    private BigDecimal interest;
    

    though interest is not really money. This is a temporal dirty trick.
    It would interesting that when you use @Digits the data in list would be formatted accordly, please add it as a feature request.


    Help others in this forum as I help you.
    Need more help? Get OpenXava professional support.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks