You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Alfredo Aleandri <al...@logobject.ch> on 2009/05/12 15:19:34 UTC

Datatable columns converter

Hi,
I can't figure out the best way to define something like a 
object-to-string converter to add to a DataTable's column (PropertyColumn).
I have an Integer in my model and I want to display a proper String to 
the user by a defined mapping.

Thank you

alf


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Datatable columns converter

Posted by "alf.redo" <al...@logobject.ch>.
Hi Michael, thank you for your suggestion.
what do you think about overriding the AbstractColumn#populateItem() to add
a Label to the cellItem and setting up a proper IConverter to that
component? 

bye

alf


Michael O'Cleirigh wrote:
> 
> 
> This question came up last week aswell, here is an example of how you to 
> subclass PropertyColumn to convert an integer into an arbitrary string:
> 
> 
> http://www.nabble.com/Re%3A-How-to-manipulate-values-in-a-data-table--p23413680.html
> 
> Essentially you wrap the PropertyModel with a custom IModel 
> implementation that does the conversion you want (on each cell).  Then 
> you build the DataTable using your custom column implementation.
> 
> 

-- 
View this message in context: http://www.nabble.com/Datatable-columns-converter-tp23502460p23519993.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Datatable columns converter

Posted by Michael O'Cleirigh <mi...@rivulet.ca>.
Hi Alfredo,

This question came up last week aswell, here is an example of how you to 
subclass PropertyColumn to convert an integer into an arbitrary string:

 http://www.nabble.com/Re%3A-How-to-manipulate-values-in-a-data-table--p23413680.html

Essentially you wrap the PropertyModel with a custom IModel 
implementation that does the conversion you want (on each cell).  Then 
you build the DataTable using your custom column implementation.

Regards,

Mike

> Hi,
> I can't figure out the best way to define something like a 
> object-to-string converter to add to a DataTable's column 
> (PropertyColumn).
> I have an Integer in my model and I want to display a proper String to 
> the user by a defined mapping.
>
> Thank you
>
> alf
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org