Re: AjaxLink causes list model to be detached before rendering!

2012-01-09 Thread Sven Meier
Hi Philip, ListView throws away all its children before rendering. When a component is removed, its model gets detached. Your AjaxLink has your LoadableDetachableModel as model, thus it forces it to be detached too. As a possible solution, don't keep a reference to the model as your

Re: AjaxLink causes list model to be detached before rendering!

2012-01-09 Thread Philip Wilkinson
Sven, Thanks for your speedy reply. Indeed you are correct, removing the model from the AjaxLink stops the model from becoming detached immediately before rendering. I now realise that my cut-down example was too cut-down! The AjaxLink is actually there to remove the entry from the list,

Re: AjaxLink causes list model to be detached before rendering!

2012-01-09 Thread Igor Vaynberg
the problem here is that the listitem's model is tied to the listview's model. so calling detach() on the listview item causes the detachment of the listview's model. you can either override getlistitemmodel() on the listview and give each item an isolated model, or you can use a dataview or

Re: AjaxLink causes list model to be detached before rendering!

2012-01-09 Thread Sven Meier
you can ... give each item an isolated model Actually ListItemModel doesn't detach the owning list's model, so it's 'isolated' already. For your AjaxLink you can access the list view instead: IModelListString model = ... // not final !! final ListViewString rows = new

Re: AjaxLink causes list model to be detached before rendering!

2012-01-09 Thread Philip Wilkinson
Thanks Sven, interesting idea however, rows is not accessible to onClick() method as compilation error, rows not accessible as may not be initialised. I guess Id have to getParent() loop until I found a ListView component :( Cheers, Phil. On Mon, Jan 9, 2012 at 6:31 PM, Sven Meier

Re: AjaxLink causes list model to be detached before rendering!

2012-01-09 Thread Sven Meier
Ah, yes, stupid compiler ;). You can keep the model final and use it on your onClick(), but *not* passing it to the AjaxLink constructor: final IModelListStringmodel = ... // final again !! final ListViewStringrows = new ListViewString(rows, model) {

Re: AjaxLink causes list model to be detached before rendering!

2012-01-09 Thread Philip Wilkinson
Hi Sven, OK thanks, that's good, with this.. final IModelListString model = new LoadableDetachableModelListString() { @Override protected ListString load() { System.out.println(LOAD LIST

AjaxLink causes list model to be detached before rendering!

2012-01-08 Thread Philip Wilkinson
Hi, Can anyone tell me why when I refresh a wicket page which has on it an AjaxLink, my list model is being detached just before its contents are rendered by a list view? I would expect detach only to be called after everything has been rendered. Detaching just before rendering would call a