Revisiting this.
I'm still having some troubles with this.

Say I have:
Label a;
add(a = Label(...)
{ onConfigure(){setVisible(*false due to some condition*)}});
a.setOutputMarkupId(true);

add(new AjaxLink(..){
    onClick(AjaxRequestTarget t){t.add(a);}
};

In this case the debug window will start calling mayhem as clearly label a is not on the page so it can't find the component to update.

So my question is:
Is it common practice to always do something like:
AjaxLink(){
    onClick(AjaxRequestTarget t){
       if(a.isVisibleInHierarchy())
           t.add(a);
    }
}

Or should I always do:
add(a = Label(...)
{ onConfigure(){setVisible(*false due to some condition*)}});
a.setOutputMarkupId(true);
showPhoto.setOutputMarkupPlaceholderTag(true);

Or could the AjaxRequestTarget be modified to do the isVisibleInHierarchy() before actually rendering the component?

Thanks

On 6-9-2012 22:47, Thijs Vonk wrote:
OK thnx will give it a try

On 6/9/12 22:39, Igor Vaynberg wrote:
isVisibleInHierarchy() will make sure all parents are visible as well

-igor

On Thu, Sep 6, 2012 at 1:27 PM, Thijs Vonk <vonk.th...@gmail.com> wrote:
Hi,

We have partial page updates all over a page. So panels and components all
over the place that need Ajax updates.
We're using an Interface on those components and with an IVisitor we
traverse the component tree and add every component to the target that has
this interface.

But during development we see that we get errors in the ajax debug log when these components have an invisible state. These components themselves can have this state but some of the times, the parent component is invisible. In these cases when such a hidden component is added to the AjaxRequestTarget
we get an error in the ajax debug log.

Adding the isVisible check before adding the component to the target could
save us in some situations but not all (as it might get visible or
invisible) at a later state.
How can I prevent these components from being added to the
AjaxRequestTarget? Or from the error being thrown? I had hoped that a
component being in an invisible state (somewhere in the tree) wouldn't get rendered. It's not really a problem in a 'deployment' situation, but it's
not 'nice' either.


Thijs

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

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




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

Reply via email to