You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Chris <ch...@gmx.at> on 2015/02/02 18:15:38 UTC
swap panels from child element
Hi,
I would like to swap panels B and C when the user clicks on a certain div element in Subpanel Aa
The Page consists of following panels:
- Panel A > Subpanel Aa
- Panel B
- Panel C
How can I access the panels B and C and replace them or change their visibility from the WebMarkupContainer onEvent(AjaxRequestTarget target) method?
Is it better to replace them or change their visibility?
Subpanel Aa:
…
WebMarkupContainer div=new WebMarkupContainer(„item");
div.setOutputMarkupId(true);
div.add(new AjaxEventBehavior("onclick") {
protected void onEvent(AjaxRequestTarget target) {
}
});
...
Thanks,
Chris
Re: swap panels from child element
Posted by Sven Meier <sv...@meiers.net>.
Hi,
replacing is really easy:
this.addOrReplace(panel);
... as long as all your panels have an identical Wicket id.
I often prefer this approach over changing visibility because of smaller
session size (i.e. not keeping unused panels in the component tree) and
simpler markup (i.e. not requiring a <div> for each panel).
Your mileage may vary.
Regards
Sven
On 02.02.2015 18:15, Chris wrote:
> Hi,
>
> I would like to swap panels B and C when the user clicks on a certain div element in Subpanel Aa
>
> The Page consists of following panels:
> - Panel A > Subpanel Aa
> - Panel B
> - Panel C
>
> How can I access the panels B and C and replace them or change their visibility from the WebMarkupContainer onEvent(AjaxRequestTarget target) method?
> Is it better to replace them or change their visibility?
>
> Subpanel Aa:
> …
> WebMarkupContainer div=new WebMarkupContainer(„item");
> div.setOutputMarkupId(true);
> div.add(new AjaxEventBehavior("onclick") {
> protected void onEvent(AjaxRequestTarget target) {
>
>
> }
> });
> ...
>
> Thanks,
> Chris
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: swap panels from child element
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
You can use Wicket Events -
http://www.wicket-library.com/wicket-examples-6.0.x/events/
Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov
On Mon, Feb 2, 2015 at 8:25 PM, Grün Christoph <ch...@ec.tuwien.ac.at>
wrote:
> Andrea - thanks, but how can I access the panels from a child panel within
> the component hierarchy of a page without having to put them in the
> constructor of each child panel?
>
> best regards,
> Chris
>
> > Am 02.02.2015 um 19:02 schrieb Andrea Del Bene <an...@gmail.com>:
> >
> > Changing visibility is less complex and if the result looks good I would
> go for it.
> >> Hi,
> >>
> >> I would like to swap panels B and C when the user clicks on a certain
> div element in Subpanel Aa
> >>
> >> The Page consists of following panels:
> >> - Panel A > Subpanel Aa
> >> - Panel B
> >> - Panel C
> >>
> >> How can I access the panels B and C and replace them or change their
> visibility from the WebMarkupContainer onEvent(AjaxRequestTarget target)
> method?
> >> Is it better to replace them or change their visibility?
> >>
> >> Subpanel Aa:
> >> …
> >> WebMarkupContainer div=new WebMarkupContainer(„item");
> >> div.setOutputMarkupId(true);
> >> div.add(new AjaxEventBehavior("onclick") {
> >> protected void onEvent(AjaxRequestTarget target) {
> >>
> >>
> >> }
> >> });
> >> ...
> >>
> >> Thanks,
> >> Chris
> >>
> >>
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
>
>
Re: swap panels from child element
Posted by Grün Christoph <ch...@ec.tuwien.ac.at>.
Andrea - thanks, but how can I access the panels from a child panel within the component hierarchy of a page without having to put them in the constructor of each child panel?
best regards,
Chris
> Am 02.02.2015 um 19:02 schrieb Andrea Del Bene <an...@gmail.com>:
>
> Changing visibility is less complex and if the result looks good I would go for it.
>> Hi,
>>
>> I would like to swap panels B and C when the user clicks on a certain div element in Subpanel Aa
>>
>> The Page consists of following panels:
>> - Panel A > Subpanel Aa
>> - Panel B
>> - Panel C
>>
>> How can I access the panels B and C and replace them or change their visibility from the WebMarkupContainer onEvent(AjaxRequestTarget target) method?
>> Is it better to replace them or change their visibility?
>>
>> Subpanel Aa:
>> …
>> WebMarkupContainer div=new WebMarkupContainer(„item");
>> div.setOutputMarkupId(true);
>> div.add(new AjaxEventBehavior("onclick") {
>> protected void onEvent(AjaxRequestTarget target) {
>>
>>
>> }
>> });
>> ...
>>
>> Thanks,
>> Chris
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
Re: swap panels from child element
Posted by Andrea Del Bene <an...@gmail.com>.
Changing visibility is less complex and if the result looks good I would
go for it.
> Hi,
>
> I would like to swap panels B and C when the user clicks on a certain div element in Subpanel Aa
>
> The Page consists of following panels:
> - Panel A > Subpanel Aa
> - Panel B
> - Panel C
>
> How can I access the panels B and C and replace them or change their visibility from the WebMarkupContainer onEvent(AjaxRequestTarget target) method?
> Is it better to replace them or change their visibility?
>
> Subpanel Aa:
> …
> WebMarkupContainer div=new WebMarkupContainer(„item");
> div.setOutputMarkupId(true);
> div.add(new AjaxEventBehavior("onclick") {
> protected void onEvent(AjaxRequestTarget target) {
>
>
> }
> });
> ...
>
> Thanks,
> Chris
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org