You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Kirk Israel <ki...@kisrael.com> on 2007/09/14 22:35:47 UTC

Wicket visibility and Panel positioning

I looked over a lot of the usual examples but didn't quite find what I
was looking for... I also tried looking for more information inside of
Pro Wicket. As always, pointers to useful examples and documentation
appreciated.

My overall task is to make a dropdown menu, one that appears under a
graphical "More" Ajax Link, some kind of Panel containing clickable
links.

First question on visibility: in the Java i had something like
        moreMenuPanel = new WebMarkupContainer("moreMenu");
        moreMenuPanel.setVisible(false);
        moreMenuPanel.setOutputMarkupId(true);
        add(moreMenuPanel);
against html
         <div wicket:id="moreMenu">Hey there</div>	

And then there was an AjaxFallbackLink with
          public void onClick(AjaxRequestTarget ajaxTarget) {
                moreMenuPanel.setVisible(true);
                ajaxTarget.addComponent(moreMenuPanel);
            }

This didn't do what i expected, the panel didn't appear. The Ajax console shows
ERROR: Component with id [[moreMenu72]] a was not found while trying
to perform markup update. Make sure you called
component.setOutputMarkupId(true) on the component whose markup you
are trying to update.

Is the initial invisibility messing things up? I think I've heard that
Wicket will sometimes not display any markup for things where
isVisible is false? Though in this case in the page source I see
<div id="moreMenu72">Hey there</div>	

We have a work around of having an AttributeModifier to set the
visibility, but it seems rather crude... or am i missing the point of
how visibility is used in Wicket?

And once that's solved, there's still the problem of positioning...
ideally this panel is floating, and can be passed a component on the
Java that will determine where it appears. Is this something that
needs to be built from a fairly low level w/ behaviors and custom
javascript, or is there something closer to ready to go?

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


Re: Wicket visibility and Panel positioning

Posted by Matej Knopp <ma...@gmail.com>.
The panel is not rendered when you call setVisible(false). So the
subsequent ajax update has no dom element to replace. You can call
panel.setOutputMarkupPlaceholderTag(true) to work around it.

-Matej

On 9/14/07, Kirk Israel <ki...@kisrael.com> wrote:
> I looked over a lot of the usual examples but didn't quite find what I
> was looking for... I also tried looking for more information inside of
> Pro Wicket. As always, pointers to useful examples and documentation
> appreciated.
>
> My overall task is to make a dropdown menu, one that appears under a
> graphical "More" Ajax Link, some kind of Panel containing clickable
> links.
>
> First question on visibility: in the Java i had something like
>         moreMenuPanel = new WebMarkupContainer("moreMenu");
>         moreMenuPanel.setVisible(false);
>         moreMenuPanel.setOutputMarkupId(true);
>         add(moreMenuPanel);
> against html
>          <div wicket:id="moreMenu">Hey there</div>
>
> And then there was an AjaxFallbackLink with
>           public void onClick(AjaxRequestTarget ajaxTarget) {
>                 moreMenuPanel.setVisible(true);
>                 ajaxTarget.addComponent(moreMenuPanel);
>             }
>
> This didn't do what i expected, the panel didn't appear. The Ajax console shows
> ERROR: Component with id [[moreMenu72]] a was not found while trying
> to perform markup update. Make sure you called
> component.setOutputMarkupId(true) on the component whose markup you
> are trying to update.
>
> Is the initial invisibility messing things up? I think I've heard that
> Wicket will sometimes not display any markup for things where
> isVisible is false? Though in this case in the page source I see
> <div id="moreMenu72">Hey there</div>
>
> We have a work around of having an AttributeModifier to set the
> visibility, but it seems rather crude... or am i missing the point of
> how visibility is used in Wicket?
>
> And once that's solved, there's still the problem of positioning...
> ideally this panel is floating, and can be passed a component on the
> Java that will determine where it appears. Is this something that
> needs to be built from a fairly low level w/ behaviors and custom
> javascript, or is there something closer to ready to go?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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