James,

thanks a lot for the code snippet. My numbers are now perfectly formatted. Do
you know how to right align the column? Normally, I would do this in the
markup but I don't see a possibility where I can modify this in the code.

Thanks again

Andreas 

> -----Original Message-----
> From: James Carman [mailto:[email protected]] 
> Sent: Wednesday, February 24, 2010 8:35 PM
> To: [email protected]
> Subject: Re: format float/double in dataview
> 
> public class MessageFormatColumn<T> extends PropertyColumn<T>
> {
>     private final String pattern;
> 
>     public MessageFormatColumn(IModel<String> displayModel, String
> propertyExpression, String pattern)
>     {
>         super(displayModel, propertyExpression);
>         this.pattern = pattern;
>     }
> 
>     public MessageFormatColumn(IModel<String> displayModel, String
> sortProperty, String propertyExpression, String pattern)
>     {
>         super(displayModel, sortProperty, propertyExpression);
>         this.pattern = pattern;
>     }
> 
>     @Override
>     protected IModel<?> createLabelModel(IModel<T> itemModel)
>     {
>         IModel<?> superModel = super.createLabelModel(itemModel);
>         return new Model<String>(MessageFormat.format(pattern,
> superModel.getObject()));
>     }
> }
> 
> 
> On Wed, Feb 24, 2010 at 1:43 PM, Andreas Lüdtke 
> <[email protected]> wrote:
> > I'm displaying doubles in an AjaxFallbackDefaultDataTable. 
> Is it possible to
> > format them i.e. with a precision of 2 digits and right aligned?
> >
> > Currently I don't see a possibility to do this.
> >
> > Thanks
> >
> >        Andreas
> >
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to