You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Beyonder Unknown <be...@yahoo.com> on 2008/01/14 23:04:26 UTC

how to reference component in RequestTarget

Hi All,

I was wondering what is the best practice when referencing components inside an onClick/onSubmit. Normally:

                    public void onClick(AjaxRequestTarget target) {
                              //do things here.
                                //update these components.
                              target.addComponent(panelA);
                              target.addComponent(panelB);

                    }

But what if you don't have direct access to PanelA or PanelB? 

Any help will be greatly appreciated!

Thanks,
Wen Tong
 
--
The only constant in life is change.




      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 


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


Re: how to reference component in RequestTarget

Posted by Martijn Lindhout <ml...@jointeffort.nl>.
what is exactly the usecase?

2008/1/14, Beyonder Unknown <be...@yahoo.com>:
>
>
> Hi All,
>
> I was wondering what is the best practice when referencing components
> inside an onClick/onSubmit. Normally:
>
>                     public void onClick(AjaxRequestTarget target) {
>                               //do things here.
>                                 //update these components.
>                               target.addComponent(panelA);
>                               target.addComponent(panelB);
>
>                     }
>
> But what if you don't have direct access to PanelA or PanelB?
>
> Any help will be greatly appreciated!
>
> Thanks,
> Wen Tong
>
> --
> The only constant in life is change.
>
>
>
>
>
>       ____________________________________________________________________________________
> Be a better friend, newshound, and
> know-it-all with Yahoo! Mobile.  Try it now.
> http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martijn Lindhout
JointEffort IT Services
http://www.jointeffort.nl
mlindhout@jointeffort.nl
+31 (0)6 18 47 25 29

Re: how to reference component in RequestTarget

Posted by Timo Rantalaiho <Ti...@ri.fi>.
On Mon, 14 Jan 2008, Beyonder Unknown wrote:
> I was wondering what is the best practice when referencing components inside an onClick/onSubmit. Normally:
> 
>                     public void onClick(AjaxRequestTarget target) {
>                               //do things here.
>                                 //update these components.
>                               target.addComponent(panelA);
>                               target.addComponent(panelB);
> 
>                     }
> 
> But what if you don't have direct access to PanelA or PanelB? 

As far as I know, there is currently no single recommended
way of doing this. We've tried abstract callback methods and
different ajax-update-listener objects but have found all of
them left wanting.

Sometimes something like this

    getPage().visitChildren(PanelA.class, new IVisitor() {
        ... target.addComponent(component);
	...
    }

might work and we've used a more generic solution along
those lines as well. 

You can also search the list on this, one thread was called
something like "inter component events".

Best wishes,
Timo

-- 
Timo Rantalaiho           
Reaktor Innovations Oy    <URL: http://www.ri.fi/ >

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