You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Mika Salminen <mj...@cc.hut.fi> on 2007/12/16 22:30:49 UTC
Problem with hiding/showing components with AJAX and isVisible()
Hello,
I encountered a problem with hiding/showing components with ajax. If a
component is initially not visible according to the isVisible() method, it
is not rendered on the page. But if it becomes visible as an effect of
ajax request and I try to update it on the client by adding the component
to AjaxRequesTarget it will still not be shown.
I think that the problem is caused by the fact that if component is not
initially visible nothing, even a placeholder for the component is not
rendered to the client. So when ajax response that tries to replace the
component in DOM tree is executed on the client, it can not find any
component with the markup id and therefore can not replace some node that
does not exist.
There are multiple quite easy workarounds for this hiding problem. For
example using CSS visibility attribute (quite ugly), or placing the
component you are willing to hide and show in a markup container that is
always rendered and sending back update of this markup container in ajax
request instead of the contained component.
But I somehow think that it is quite peculiar that one needs to find
workarounds for this kind of trivial-looking task. I did not create bug
(or improvement request) yet because I want to know what others think
about this and I'm quite new to the framework so I might be doing
something wrong.
If it is necessary to make improvements to framework to fix this, how
about adding placeholders in HTML for non-rendered components. Instead of
not rendering anything at all, empty div or span with necessary markup id
could be rendered.
Thanks,
-Mika
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Problem with hiding/showing components with AJAX and isVisible()
Posted by Martijn Dashorst <ma...@gmail.com>.
lol,
the five minutes included moderation mind you :)
Martijn
On Dec 16, 2007 11:09 PM, Mika Salminen <mj...@cc.hut.fi> wrote:
>
> Hi,
>
> Thanks a lot. Did not expect to get the answer in 5 minutes =). I should
> have read the docs better since the improvement I was suggesting was
> already
> implemented. You just got a new buyer for the book.
>
> -Mika
>
>
> --
> View this message in context:
> http://www.nabble.com/Problem-with-hiding-showing-components-with-AJAX-and-isVisible%28%29-tp14366588p14367024.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0-rc1 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-rc1/
Re: Problem with hiding/showing components with AJAX and
isVisible()
Posted by Mika Salminen <mj...@cc.hut.fi>.
Hi,
Thanks a lot. Did not expect to get the answer in 5 minutes =). I should
have read the docs better since the improvement I was suggesting was already
implemented. You just got a new buyer for the book.
-Mika
--
View this message in context: http://www.nabble.com/Problem-with-hiding-showing-components-with-AJAX-and-isVisible%28%29-tp14366588p14367024.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Problem with hiding/showing components with AJAX and isVisible()
Posted by Martijn Dashorst <ma...@gmail.com>.
setOutputMarkupPlaceholderTag(true)
Martijn
On Dec 16, 2007 10:30 PM, Mika Salminen <mj...@cc.hut.fi> wrote:
> Hello,
>
> I encountered a problem with hiding/showing components with ajax. If a
> component is initially not visible according to the isVisible() method, it
> is not rendered on the page. But if it becomes visible as an effect of
> ajax request and I try to update it on the client by adding the component
> to AjaxRequesTarget it will still not be shown.
>
> I think that the problem is caused by the fact that if component is not
> initially visible nothing, even a placeholder for the component is not
> rendered to the client. So when ajax response that tries to replace the
> component in DOM tree is executed on the client, it can not find any
> component with the markup id and therefore can not replace some node that
> does not exist.
>
> There are multiple quite easy workarounds for this hiding problem. For
> example using CSS visibility attribute (quite ugly), or placing the
> component you are willing to hide and show in a markup container that is
> always rendered and sending back update of this markup container in ajax
> request instead of the contained component.
>
> But I somehow think that it is quite peculiar that one needs to find
> workarounds for this kind of trivial-looking task. I did not create bug
> (or improvement request) yet because I want to know what others think
> about this and I'm quite new to the framework so I might be doing
> something wrong.
>
> If it is necessary to make improvements to framework to fix this, how
> about adding placeholders in HTML for non-rendered components. Instead of
> not rendering anything at all, empty div or span with necessary markup id
> could be rendered.
>
> Thanks,
>
> -Mika
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0-rc1 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-rc1/