You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by andrea pantaleoni <an...@fao.org> on 2007/09/03 13:46:03 UTC

AJAX and Components Hierarchy

Hi,
I'm implementing some Behaviors in a complex page which contains many panels
and components most of them nasted.

Exactly now, I'm adding a behavior to a button to change  the model of the
entire component 
Then I want that the component reload the model and performe the changings 
Inside a AjaxFormComponentUpdatingBehavior I do this:
ajaxRequestTarget.addComponent(mainComponent)
It works fine and the main component change properly.
The problem I get now  is that also every child components (DropDownChoice
ecc...) change and reload the model .
In this way every user selection is lost.
Is there a way to let just the main component change and not his child
components?
Once again thanks a lot for any suggestion.
Andrea  
-- 
View this message in context: http://www.nabble.com/AJAX-and--Components-Hierarchy-tf4371738.html#a12460367
Sent from the Wicket - User mailing list archive at Nabble.com.

Re: AJAX and Components Hierarchy

Posted by Igor Vaynberg <ig...@gmail.com>.
sounds like you are reusing the model instances? if you do not want the
change to propogate then simply clone the model before passing it on to a
child

so instead of

class mypanel extends panel {
   public mypanel(id, model) {
     add(new dropdownchoice("id", _model_, ...

do

     add(new dropdownchoice("id", (IModel)Objects.clone(model), ...

-igor

On 9/3/07, andrea pantaleoni <an...@fao.org> wrote:
>
>
> Hi,
> I'm implementing some Behaviors in a complex page which contains many
> panels
> and components most of them nasted.
>
> Exactly now, I'm adding a behavior to a button to change  the model of the
> entire component
> Then I want that the component reload the model and performe the changings
> Inside a AjaxFormComponentUpdatingBehavior I do this:
> ajaxRequestTarget.addComponent(mainComponent)
> It works fine and the main component change properly.
> The problem I get now  is that also every child components (DropDownChoice
> ecc...) change and reload the model .
> In this way every user selection is lost.
> Is there a way to let just the main component change and not his child
> components?
> Once again thanks a lot for any suggestion.
> Andrea
> --
> View this message in context:
> http://www.nabble.com/AJAX-and--Components-Hierarchy-tf4371738.html#a12460367
> Sent from the Wicket - User mailing list archive at Nabble.com.
>