sure I can have reference to customerModel by making it final. But I want to get as much garbe collected as possible at the end of request and making the reference final wouldn't help it much :)

But considering the speed issue, maybe it is better to use redirect_to_buffer after all ;)
one line in link handler won't kill me.

-Matej



Johan Compagner wrote:
hmm because of that i didn't go for redirect_to_render..
The redirect to buffer is by far the fastest approach.
And depending on that a redirect does happen and that does the detach and the attach again for you
doesn't seem good programming to me ;)

can't you just have a reference directly to youre customersModel ??

johan



Matej Knopp wrote:

Okay, thank you, this works.

Nevertheless putting

    getParent().getParent().getModel().detach();

to link handler doesn't seem very pretty.
Maybe like I'll just stick with Redirect to render. :)

-Matej


Johan Compagner wrote:

detach youre model first.

Because a model in redirect_to_buffer isn't loaded twice because all is done in one request.

customersModel.detach()  should do the trick

or remove the deleted customer specific from that model

johan


Matej Knopp wrote:

Hi.

For a long time I was working with render strategy set to REDIRECT_TO_RENDER. Now I've switched to REDIRECT_TO_BUFFER and found out, that removing items from ListViews no longer works.

I've code like

        IModel customersModel = new LoadableDetachableModel() {
            protected Object load() {
                return CustomerDAO.getAllCustomers();
            }
        };

    add (new ListView("customers", customersModel) {
            protected void populateItem(ListItem item) {
                Customer customer = (Customer) item.getModelObject();

                ...
                item.add(new Link("delete") {
                    public void onClick() {
Customer customer = (Customer) getParent().getModelObject();
                        CustomerDAO.delete(customer);
                    }
                });
            }
        });

The problem is, that after deleting a cutomer, the list is not updated until page refresh (the model doesn't get reloaded and list refreshed).
What's the recommended solution to this?

Thanks.

-Matej


-------------------------------------------------------
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



-------------------------------------------------------
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




-------------------------------------------------------
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



-------------------------------------------------------
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




-------------------------------------------------------
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