Hi Andrea,
ListView is only renderer for Radio elements, in real
life selectOneRadioItems isn't empty array. Code little bit difficult to
understand. But problem it setting model value after form submission
RadioGroup instance didn't put value to model, but on rendering phase it
reading data from model.
Wicket version 1.5.7.
Valery Gorbunov
On Sat, Aug 11, 2012 at 12:12 AM, Andrea Del Bene <[email protected]>wrote:
> Hi and welcome to this mailing list!
>
> it's not clear to me the purpose of the ListView in your code. Why do you
> need it and what is the relation between this component and RadioGroup?
>
>> Hello there, mighty developers.
>> I'm quite new in Wicket, so beforehand sorry if my question is stupid.
>> So what i have is a RadioGroup, with some childs. When page loads for the
>> first time,
>> one of child gets selected by default, and everything is fine. But, when i
>> change selection and
>> press submit button ( non-Ajax ), form validates,re-renders and "default"
>> child instead of selected one gets selection.
>> What i'm doing wrong or not doing at all?
>>
>> here is the example of how childs get populated :
>>
>> SelectItem[] selectOneRadioItems = new SelectItem[]{};
>> RadioGroup radioGroup = new RadioGroup("radioGroup", new Model());
>> ListView<SelectItem> selectOneRadioListItems = new
>> ListView<SelectItem>("**radioGroup", Arrays.asList(**selectOneRadioItems))
>> {
>> protected void populateItem(ListItem<**SelectItem> item) {
>> Label label = new Label("label", new
>> Model<String>(item.getModel().**getObject().getLabel()));
>> item.add(label);
>> SelectItemModel<Serializable> itemModel = new
>> SelectItemModel<Serializable>(**SelectItem)item.getModel().**
>> getObject());
>> Radio<Serializable> radio = new Radio<Serializable>("radio",
>> itemModel,
>> RadioGroupParent);
>> item.add(radio);
>> }
>> };
>>
>> Any tips will be appreciated.
>>
>>
>>
>> --
>> View this message in context: http://apache-wicket.1842946.**
>> n4.nabble.com/RadioGroup-**tp4651132.html<http://apache-wicket.1842946.n4.nabble.com/RadioGroup-tp4651132.html>
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail:
>> users-unsubscribe@wicket.**apache.org<[email protected]>
>> For additional commands, e-mail: [email protected]
>>
>>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail:
> users-unsubscribe@wicket.**apache.org<[email protected]>
> For additional commands, e-mail: [email protected]
>
>