you can pull, you just have to override each item's model. in getListItemModel() return a detachable model that can load the item by pk, otherwise you can run into big problems on the callback.

ie: on render you return A,B,C,D
on callback you return A,B,E,F,D

now if on this callback user clicked on C you will actually be working on E which is a big booboo. this is why i integrated model() call into the idataprovider - so people dont forget.

this only solves it partially though - added formvalidators are still going to be a problem for removed items - not sure about the best approach right now - we might have to open more api or make validation smarter - lets discuss this some more.

-Igor


On 8/8/06, Joni Freeman <[EMAIL PROTECTED]> wrote:
Consider following form which uses ListView with pull model.

public MyForm extends Form {
    public MyForm(String id, IModel model) {
        super(id, model);
        add(new ListView("items") {
            public IModel getModel() {
                return new Model(dao.findAll());
            }

            protected void populateItem(final ListItem item) {
                FormComponent text1 = new TextField("t1");
                FormComponent text2 = new TextField("t2");
                item.add(text1);
                item.add(text2);
                MyForm.this.add(new MyFormValidator(text1, text2));
            }
        };
    }

    protected void onSubmit() {
        // hello world!
    }
}

Now, the first submit is ok, but if the validation fails during the
first submit and the user presses submit again, the whole form fails to
Caused by: java.lang.IllegalStateException: No Page found for component
[MarkupContainer [Component id = TextField.text, page = <No Page>, path
= 1:semester.length:start:TextField.text]]
  at wicket.Component.getPage (Component.java:1022)
  at wicket.Component.hasErrorMessage(Component.java:1226)
  at
wicket.markup.html.form.FormComponent.isValid(FormComponent.java:442)
...

Why? Because the Form instance contains FormValidators which reference
old instances of FormComponents. These old instances are not in a Form
after the first submit because the ListView uses pull model and
therefore can't call setReuseItems(true);

So, it seems that it is not possible to use pull model ListView in a
Form?

Joni


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to