Hi Hannes,

Shouldn't the detaching of the ListModel be handled by the ListView itself? Why would you detach the complete ListModel from inside a component in the ListView? You could always send an event to the parent of the ListItem however ...

Greetings,

Johannes

On 11/07/2024 13:44, Hannes Becker wrote:
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



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

Reply via email to