Hi!

Thanks for your feedback.

Maybe I need to elaborate my point a little bit more. It's not about Components 
detaching Models but about the detaching-responsibility of dependent models.

A detach on a (child) Model, which depends on another (parent) Model normally 
detaches also the parent Model. The most "prominent" example is the default 
implementation of IModel.map(...).

In opposition to that, ListItemModel.detach() has a (default) 
noop-implementation and I am wondering why it is not implemented as the 
following:

----
@Override
public void detach()
{
      listView.getModel().detach();
}
----

This is actually a problem for me, because I have a LoadableDetachableModel, 
which is the "parent" Model for the ListView. This LoadableDetachableModel 
needs to be detached but I don't have a reference to the 
LoadableDetachableModel in the Component which is rendered inside the ListView. 
If detach would be implemented in the way I proposed (and how it is implemented 
in IModel.map(...)), it would just work.
Thus, I suggest do implement detach as described above in ListItemModel.

Best regards,
Hannes

________________________________
From: Martin Terra <martin.te...@koodaripalvelut.com>
Sent: Wednesday, July 10, 2024 12:57
To: users@wicket.apache.org <users@wicket.apache.org>
Subject: Re: ListItemModel is not detaching List-model

Normally it's the other way, a component detaches it's model.

The ListItemModel isn't really holding any data, it is relying on the
actual model held by listView.

**
Martin

ke 10. heinäk. 2024 klo 13.53 Hannes Becker (hannes.bec...@proxora.com)
kirjoitti:

> Hi!
>
> I am wondering why org.apache.wicket.markup.html.list.ListItemModel is not
> detaching the ListView's model. Feels to me like a bug...or is there an
> explanation?
>
> Thanks for your help and best regards
> Hannes
>
>

Reply via email to