*SOLVED*.

I found what was wrong.
In case anyone needs a component like this, the main updated code is:

final Model dataModel = new Model();
dataModel.setObject(data);

ListView listView = new ListView("list", dataModel)
{

    protected void populateItem(ListItem item)
    {
        final IModel model = item.getModel();

        NameWrapper comboItem /*a kind of temp object for the
DropDownChoice:*/
            = new
NameWrapper(((NameWrapper)model.getObject()).getComboId(),((NameWrapper)model.getObject()).getComboText());
        final DropDownChoice combo = new DropDownChoice("combo"
                                    , new Model(comboItem)
                                    , CHOICES /* a list of possible choices
*/
                                    , new
ChoiceRenderer("comboText","comboId"));

        combo.add(new NameWrapperValidator(data));//data: the ListView's
object model. It will be iterated in my validator and call the
"error(validatable)" if there is more than one item of the current item. One
choice can be present only once in the whole list.
                        combo.add(new
AjaxFormComponentUpdatingBehavior("onchange"){
                            @Override
                            protected void onUpdate(AjaxRequestTarget
target) {
                                //the temp object will update the ListView's
Model (object named "data")

((NameWrapper)model.getObject()).setComboId(((NameWrapper)combo.getModelObject()).getComboId());

((NameWrapper)model.getObject()).setComboText(((NameWrapper)combo.getModelObject()).getComboText());
                            }
                        });
            item.add(combo);

    };
listView.setReuseItems(true);//so the list won't loose the new itens
add(listView);


>> --
>> View this message in context:
>> http://www.nabble.com/ListView-inside-Form%3A-retrieving-the-listview%27s-model-tp24893789p24922802.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>

Reply via email to