You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Johan Haleby <jo...@gmail.com> on 2010/09/14 16:29:03 UTC

How to update components using Ajax when ModalWindow closes?

Hi, 

When a user clicks on an Image a ModalWindow pops up where users can upload
and change this picture. When the user has uploaded a new picture and click
"OK" in the ModalWindow I want it to close down and update the previous
Image with the new image. How ever I cannot get the Image to update using
Ajax (if I reload the page the I can see the new image). The image is
wrapped in a markupcontainer which has output markup id set to true. I try
to replace the image using markupcontainer.replace(new Image(..)) and I add
the markupcontainer to the target but nothing happens. This is the same
target that I use to close the modal window. What am I doing wrong?

/Johan

-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-update-components-using-Ajax-when-ModalWindow-closes-tp2539048p2539048.html
Sent from the Users forum 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: How to update components using Ajax when ModalWindow closes?

Posted by Johan Haleby <jo...@gmail.com>.
I've managed to resolve it!

First of all I didn't add the markup container surrounding the image to the
same AjaxRequestTarget that closed the modalwindow (I don't add the markup
container to the AjaxRequestTarget at all). Instead I added a new
WindowClosedCallback to the ModalWindow. To its AjaxRequestTarget I do
"target.addChildren(MyPanel.this, Component.class)". This seems to resolve
it in combination with using NonCachingImage.

/Johan
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-update-components-using-Ajax-when-ModalWindow-closes-tp2539048p2540079.html
Sent from the Users forum 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: How to update components using Ajax when ModalWindow closes?

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Using NonCachingImage (as Nino suggested) should be necessary:
otherwise the browser might cache your image and never ask for a the
new one. Can you post your code?

Ernesto


On Wed, Sep 15, 2010 at 8:50 AM, Johan Haleby <jo...@gmail.com> wrote:
>
> This doesn't help, the image still doesn't appear.
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-update-components-using-Ajax-when-ModalWindow-closes-tp2539048p2539997.html
> Sent from the Users forum 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
>
>

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


Re: How to update components using Ajax when ModalWindow closes?

Posted by Johan Haleby <jo...@gmail.com>.
This doesn't help, the image still doesn't appear.
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-update-components-using-Ajax-when-ModalWindow-closes-tp2539048p2539997.html
Sent from the Users forum 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: How to update components using Ajax when ModalWindow closes?

Posted by nino martinez wael <ni...@gmail.com>.
Theres a special noncaching image for this NonCachingImage

2010/9/14 Johan Haleby <jo...@gmail.com>:
>
> Hi,
>
> When a user clicks on an Image a ModalWindow pops up where users can upload
> and change this picture. When the user has uploaded a new picture and click
> "OK" in the ModalWindow I want it to close down and update the previous
> Image with the new image. How ever I cannot get the Image to update using
> Ajax (if I reload the page the I can see the new image). The image is
> wrapped in a markupcontainer which has output markup id set to true. I try
> to replace the image using markupcontainer.replace(new Image(..)) and I add
> the markupcontainer to the target but nothing happens. This is the same
> target that I use to close the modal window. What am I doing wrong?
>
> /Johan
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-update-components-using-Ajax-when-ModalWindow-closes-tp2539048p2539048.html
> Sent from the Users forum 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
>
>

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