You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Johan Compagner <jc...@gmail.com> on 2008/05/01 01:26:38 UTC

Re: ListView is not gettting updated

And thats logical, your code looks weird.
You cant set the model of a radio also on the group.
Then the submit will update the selected in the radio groups model.
Butthen the radio model is also uopdated. So that one is still
selected..

On 4/30/08, Patel, Sanjay <sa...@nemours.org> wrote:
> I already tried it but it is not working.
>
> I have to do following (which I don't want) to update the listView after
> I submit the form.
>
> listView.setModel(new Model((Serializable) updatedList));
>
> -----Original Message-----
> From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
> Sent: Wednesday, April 30, 2008 2:02 PM
> To: users@wicket.apache.org
> Subject: Re: ListView is not gettting updated
>
> listview.setreuseitems(true), read listview's javadoc
>
> -igor
>
> On Wed, Apr 30, 2008 at 10:59 AM, Patel, Sanjay <sa...@nemours.org>
> wrote:
> >
> >  Hi,
> >
> >  I am using ListView and and each item in the listview is RadioGroup.
> > Now  the problem is, If radio1 is selected and I select radio2 and
> > submit  the form the selection goes back to radio1. What is wrong with
>
> > following  code?
> >
> >  final ListView listView = new ListView("abc", myList) {
> >                         protected final void populateItem(final
> > ListItem
> >  item) {
> >                                 final MyObject object = (MyObject)
> > item.getModelObject();
> >                                 final RadioGroup radioGroup = new
> > RadioGroup("radio-group", new Model());
> >
> >                                 final Model radioModel1 = new
> > Model(myObject1);
> >                                 final Model radioModel2 = new
> > Model(myObject2);
> >                                 final Model radioModel3 = new
> > Model(myObject3);
> >
> >                                 radioGroup.add(new Radio("radio1",
> > radioModel1));
> >                                 radioGroup.add(new Radio("radio2",
> > radioModel2));
> >                                 radioGroup.add(new Radio("radio2",
> > radioModel3));
> >
> >                                 // set default value for radio.
> >                                 if (object.isTrue() != null &&
> >  object.isTrue()) {
> >
> >  radioGroup.setModel(radioModel1);
> >                                 } else if (object.isFalse() != null &&
> >  object.isFalse()) {
> >
> >  radioGroup.setModel(radioModel2);
> >                                 } else {
> >
> >  radioGroup.setModel(radioModel3);
> >                                 }
> >                                 item.add(radioGroup);
> >                         }
> >                 };
> >                 form.add(listView);
> >
> >
> >  ---------------------------------------------------------------------
> >  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >  For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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