You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Fredy Mesia <fr...@gmail.com> on 2008/02/15 11:14:39 UTC

update modalWindow content

Hola People,

Maybe this is an easy one...

I've created a modal window with a panel inside. In the panel there's a
link. When I click this link I want the content of this modal window to be
completely changed. For that:

1) I get the enclosing window (the modal window)
2) get the content of this modal window
3) remove it
4) create the new content (a panel) with modalWindow.getContentId()
5) set the panel with modalWindow.setContent
6) show the window.

      public void onClick(AjaxRequestTarget target) {
        LoaderModalWindow thisEnclosingModalWindow = (LoaderModalWindow)
TasksContent.this.getParent();
        TasksContent actualContent =
(TasksContent)thisEnclosingModalWindow.get(
thisEnclosingModalWindow.getContentId());
        thisEnclosingModalWindow.remove(actualContent);
        SubTasksContent subTasksContent = new SubTasksContent(
thisEnclosingModalWindow.getContentId());
        thisEnclosingModalWindow.setContent(subTasksContent);
        thisEnclosingModalWindow.show(target);
      }

What I get when I pressed on the link is a second modalWindow!!! When I
close it, the first remains in the background. Obviously if I try to click
on any button it just crashes because the content has been removed.

I've tried to close it and reopen but the content is not refreshed.

I think that a second modal window has been started because I show it with a
new target... is this right?

How to avoid this second modal window appearance and change the content of
the existing one? Do I need to get the target the first modal window was
created with? HOW?

Gracias.

à+

Fredy