ive ran into this a couple of times myself.

there are two options

pass in a list of ids as the model and have ichoicerenderer resolve the id
to the text string

or work with pojos and have the model perform the conversion from object to
id and from id to object

-igor


On 11/27/06, Beto Siless <[EMAIL PROTECTED]> wrote:

Hi everyone,
        I'm new to wicket and have a simple question:

I want to display a dropdown choice but I don't want to bind the entire
list of objects in it. Is there a simple way to bind a key-value pair
and get into a property the selected Id and not the selected object
(like .Net dropdown)?

The solution that I'm using is implement an object called Option that
it's basically a key - value pair.

//properties
Option selectedUser

//DropDownChoice binding
List<Option> users = new ArrayList<Option>()
for(User user in UserDao.getUsers())
        users.add(new Option(user.getId(), user.getName()));

DropDownChoice choice=new DropDownChoice("ddc", new PropertyModel(this,
"selectedUser"), users);

Is there a simpler way to do this? maybe I don't understand the whole
idea of wicket very well, but I really don't want to put big objects in
the model to display only a key - value pair.

Thanks in advance
Beto

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to