I had tried this option and it does not work.
Michael Mosmann wrote:
Hi,
.. i am not sure. The model of RadioGroup should contain, wich item is
selected. The model of Radio should reflect the associated value. So if
model of RadioGroup contains "fr" and Property "selected" of item nr. 3
is "fr" this Radio is selected.
maybe this will help..
mm:)
I have a problem when using the Radio component.
Using a list of languages, where each item is a NameWrapper object with
a property "selected". The property "selected" is associated to the
radio component.
However, when presenting to the user the corresponding list of radios,
the language Polish is true, and not English (it should be the selected
option).
listLanguages.add(new NameWrapper("English", "en", "", true));
listLanguages.add(new NameWrapper("German", "de", "", false));
listLanguages.add(new NameWrapper("French", "fr", "", false));
listLanguages.add(new NameWrapper("Italian", "it", "", false));
listLanguages.add(new NameWrapper("Polish", "pl", "", false));
final RadioGroup groupQuery = new RadioGroup("groupLanguagesQuery", new
Model());
listLanguagesQuery = new ListView("listLanguagesQuery",listLanguages) {
protected void populateItem(ListItem item) {
String lang =
((NameWrapper)item.getModelObject()).getName();
item.add(new Label("nameLanguageQuery", new
StringResourceModel(lang, this, null,"XXXX")));
item.add(new Radio("checkLanguageQuery", new
PropertyModel(item.getModel(), "selected"),groupQuery));
}
};
groupQuery.add(listLanguagesQuery);
Any ideas? I really need to solve this issue.
Thank you so much.