Sven Meier wrote:
> 
> 
> datazuul wrote:
>> 
>> But as I have to use different models for the group and the listview,
>> the default setting with "user.setGender" has no effect.
>> 
> 
> Sure, the group has a model pointing to the user's gender, the listview a
> model holding all available genders.
> 
As ListView wants a List in the constructor to iterate over, I unfortunately
had to extract the enum values, which breaks the binding...


Sven Meier wrote:
> 
> Your code looks fine to me, userModel.bind("gender") works for setter and
> getter.
> 
I am using userModel.bind("gender") for the RadioGroup to bind it to
user.set/getGender and tried to set the default value with
user.setGender(Gender.MALE);. I expected some RadioGroup-inside-mechanism
that activates the Radio-button that has this value. But this does not
happen...
Maybe I have to implement a comparison inside populateItem to set the
Radio-button to "activated" when it's value is equal to the userModel's
value? But how to activate a Radio-button (should I really set the
HTML-attribute "checked" in Java-Code)?

Finally I just want to iterate over all values of an Enum and represent them
as Radio Buttons in a RadioGroup, setting one as default.
Not so unusual, should be solved by someone else before...
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-render-Enum-values-as-RadioGroup-and-set-default-value-tp2327596p2328095.html
Sent from the Wicket - User mailing list archive at Nabble.com.

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

Reply via email to