I found a possible fix to this problem. If you leave the
window.parent.setTimeout statement off and just call directly
win.current.close the modal window will be closed.
You can test this by changing getCloseJavacript method of the
ModalWindow.java to return this:

   {
        return "var win;\n" //
                + "try {\n"
                + " win = window.parent.Wicket.Window;\n"
                + "} catch (ignore) {\n"
                + "}\n"
                + "if (typeof(win) == \"undefined\" ||
typeof(win.current) == \"undefined\") {\n"
                + "  try {\n"
                + "     win = window.Wicket.Window;\n"
                + "  } catch (ignore) {\n"
                + "  }\n"
                + "}\n"
                + "if (typeof(win) != \"undefined\" &&
typeof(win.current) != \"undefined\") {\n"
                + " win.current.close();\n"
                + "}";
    }

Matej, what is the purpose of the window.parent.setTimeout in the
original code? Why couldn't the closing be done just simply by calling
win.current.close?

Ville

On Nov 7, 2007 3:00 PM, Ville Paasimaa <[EMAIL PROTECTED]> wrote:
> Have you noticed that if you try to close the example window from OK or
> CANCEL button it closes even when used through an iframe?
>
> By using firebug, you can place breakpoints to modal.js and see that this
> code is executed when the window is closed from OK button:
>
> org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
>
> On line 699:
>             if (this.isIframe() == true) {
>                 var current =
> this.content.contentWindow.Wicket.Window.current ;
>
> On line 715
>     close: function(force) {
> ... etc
>
> But the above code is not executed when the modal window is closed from the
> X button on upper right corner of the window.
>
> Could it solve the problem if the same close function would be executed from
> the X-button too?
>
>
>
>
>  On Nov 1, 2007 12:14 PM, Deepak Mahavishnu <[EMAIL PROTECTED]> wrote:
> > Hello!
> >
> > I'm doing some POC testing to find out how a wicket application could be
> > used through an IFrame and noticed that closing of a ModalWindow fails.
> >
> > My setup:
> >
> > Application A:
> > -a dummy html page that has an IFrame
> > -the contents of the IFrame is requested from Application B
> > <iframe src="http://localhost:8080/mywicketapp/app/"; width="100%"
> > height="500"></iframe>
> >
> > Application B:
> > -a Wicket application that uses a ModalWindow
> > -deployed to tomcat:  http://localhost:8080/mywicketapp/
> >
> >
> > Problem:
> > The ModalWindow is not closed when OK ( or Cancel ) button is clicked when
> > Application B is used throug IFrame of Application A.
> > OK button performs the actual action (in my case deletes an item from a
> > list) but is not closed after the execution of the action.
> >
> > Closing of the ModalWindow works normally when Application B is not used
> > through an IFrame.
> >
> > Any suggestions how this could be solved?  Or is the usage through an
> IFrame
> > a bad idea from start?
> >
> > Any help is appreciated!
> >
> > Mahavishnu
> >
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to