Hi Sven,

you wrote:
> there's no requirement for components inside ListView to be stateless -
> I wonder were you got that from.

I got that from the ListView class comment and from studying the code.
The comment says:

"By default, setReuseItems is false, which has the effect that ListView 
replaces all child components by new instances. The idea behind this is that 
you always render the fresh data, and as people usually use ListViews for 
displaying read-only lists [...]".

> You can have Links, Buttons or anything else in there so removing all on
> detach is a recipe for disaster for the next incoming request.

I don't think so, because removeAll is already called in ListView.
In onPopulate, which is called in onBeforeRender by AbstractRepeater, the 
following can be found:

if (getReuseItems()) {
    [...]
} else {
    // Automatically rebuild all ListItems before rendering the
    // list view
    removeAll();
}

... then the components are recreated using populateItem.

In my opinion, the only difference in my proposal is to call removeAll 
earlier: not in onBeforeRender of the next request cycle, but in onDetach of 
the current request cycle.

Cheers,
Michael

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

Reply via email to