as matej is saying in 1.0 you have to implement youre own ChoiceList and Choice.

but if you jump on the 1.1 (first beta release will be this weekend)
then it is much simpler:

new DropDownChoice("test",youreModel, youreChoices, new ChoiceRenderer("name","id"))

And the last part "new ChoiceRenderer("name","id")" is the key
first "name" is an ognl expression for getting the display value.
second "id" is an ognl expression for getting the id value

For very special display or/and id values you can implemente IChoiceRenderer yourself
or extend ChoiceRenderer and override getDisplayValue and/or getIdValue

johan



Peter Veentjer - Anchor Men wrote:
What is the easiest way to customize the display-valuefor the items in the 
ChoiceList (except overriding the toString of the object itself)? I have been 
looking through the sources (ChoiceListModel) but I can`t find an easy way. I 
know I could write an implementation of the ChoiceList where I can control the 
IChoice creation (and the toDisplayValue implementation) but sounds like a lot 
of work for such a general problem.
Maybe it would be an idea to add a toString strategy.


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to