This just works, but not totally as you might expect...

public MyForm(String id, FooBar foobar) {
   super(id, new CompoundPropertyModel(foobar));
   add(new ListView("persons") {
       protected IModel getListItemModel(IModel model, int nr) {
return new CompoundPropertyModel(super.getListItemModel(model, nr));
       }
       public void populateItem(ListItem item) {
           add(new TextField("name"));
       }
   });
}

Anders Peterson wrote:

Thanks very much for trying to help,

I have it working now, but I'm not happy with the code - it's not "correct".

It's the small, obvious, things that are difficult for beginners.

I had this:

new Model(tmpBrand.getName(), "name")

which of course did not work. Changing to this:

new PropertyModel(tmpBrand, "name")

made things work a lot better. ;-)


Now to the part I still don't understand. The only models I explicitly create are the ones I need to populate the rows in the ListView. The Form itself does not have a Model (that I created) and I feel it should.

How would you use a CompoundPropertyModel (with the form) when it contains a ListView?

/Anders




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to