Does'nt it use a choice renderer?

ArchieC wrote:
Hi All

Im fairly new to wicket and Im going insane with an issue Im having. Ive
been doing a trawl of many forums, Wicket in action, Pro wicket, nabble,
asking questions of friendly people and trying every option I can think of
to work this out for myself using RadioChoice, RadioGroup and odd
combinations of both.

I promise Ive been trying to avoid asking this question on the forum cause
Im expecting someone to call me an idiot. So here is my question.

RadioChoice has the ability to set a value thats not the standard "radio7"
type value. As far as we (myself and the java developer I am working with)
can see, we cannot seem to do the same for a Radio component in a
RadioGroup. Are we barking up the wrong tree completely or is there a way to
set a value to an ID from our database (for example).

EG.
Instead of <input type="radio" name="group" value="radio7" />

I get <input type="radio" name="group" value="353" />  (353 being the
user_id of one of the accounts, set in option.getValue() - please see code
snippet below).

Here is the reason we cant just use a RadioChoice. The list we are making
contains about 1000 User account names, each with a user level denoted by an
icon next to each name and radio button. RadioChoice doesnt give the option
of doing different icons (Label with IMG html in it for Icons) for each name
as setPrefix just sets one for the whole list. The list is basically acting
like a drop down box so that I can select one of the accounts for editing on
the next page.

Im really stumped by this as I cant seem to find any reference to setting
this value on a Radio component and I cant believe the creators of Wicket
would make a pointless component.

Here is my code if that helps

RadioGroup group=new RadioGroup("group", new Model(id));
            final ArrayList <SelectOptionLevel> selectOptionLevel =
getDdcChoices();
            ListView persons=new ListView("persons", selectOptionLevel) {
            /**
* */
             private static final long serialVersionUID = 1L;
                protected void populateItem(ListItem item) {
                    SelectOptionLevel option = (SelectOptionLevel)
item.getModelObject();
//Exampe of Icon setting
                    item.add(new Label("levelImage", "< img
src='images/icons/icon1.gif'/>").setEscapeModelStrings(false));
Radio radio = new Radio( "radio", new PropertyModel(modelObject, "user") <~~ Need to set the value of the radio to my option.getValue() value.
                    );
                    item.add(radio);
                    item.add(new Label("name", option.getLabel()));
                }
            };
            group.add(persons);
            add(group);

Apart from not getting a value it all looks great just as I want.

--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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

Reply via email to