[
https://issues.apache.org/jira/browse/WICKET-1003?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12574442#action_12574442
]
Pas Filip commented on WICKET-1003:
-----------------------------------
I've had a similar problem with the modal window that it refuses to close in
firefox and ie6.
I only got this problem if using a modal window with a panel for content, using
a page all seems to work fine.
I also got this problem in a form. In a testcase i made without forms the
problem didn't present itself.
Also I wasn't using an ajaxindicating button but a plain AjaxButton (that
submits the form).
The problem seems related to the way the timeout is being called that will
close the modal window.
It seems for some reason window.parent doesn't return a window object but
instead returns some html div element.
Isn't window.parent ALWAYS supposed to return a window object?
Is it possible that some of the js for wicket modal window modifies this parent?
I used the following code to get the modal window to close.
I think it will work without introducing any new bugs. Basically I test if
window.parent has
a setTimeout method. If it does I use that to call the timeout and if it
doesn't I use window.setTimeout instead of
window.parent.setTimeout. See below for the sample code.
Another thing I thought could be improved about the modalwindow is that the
code to close the modalwindow
be a template method which by default calls the static closecurrent method.
Also it could be useful to add a setShown method with protected visibility so
people who override can set the shown flag appropriately.
Here's my implementation of the close method on the modal window:
final ModalWindow modalWindow = new ModalWindow("modalRadio") {
public void close( AjaxRequestTarget target ) {
String script = " var win;\n"
+ "try {\n" + " win = window.parent.Wicket.Window;\n"
+ "} catch (ignore) {}\n"
+ "if (typeof(win) == \"undefined\" || typeof(win.current) ==
\"undefined\") {\n"
+ " try {\n"
+ " win = window.Wicket.Window;\n"
+ " } catch (ignore) {}\n"
+ "}\n"
+" var timeoutExecutor = window; \n if (
window.parent.setTimeout ) { timeoutExecutor = window.parent; } \n"
+ "if (typeof(win) != \"undefined\" && typeof(win.current) !=
\"undefined\") {\n"
+ " timeoutExecutor.setTimeout(function() {\n" + "
win.current.close();\n"
+ " }, 0);\n"
+ "} ";
target.addJavascript(script);
}
};
> Modal Window Does Not Close When Using IndicatingAjaxButton
> -----------------------------------------------------------
>
> Key: WICKET-1003
> URL: https://issues.apache.org/jira/browse/WICKET-1003
> Project: Wicket
> Issue Type: Bug
> Components: wicket-extensions
> Affects Versions: 1.3.0-beta4
> Environment: Ubuntu, Jetty, Eclipse
> Reporter: Carlo M. Camerino
> Assignee: Matej Knopp
> Fix For: 1.3.2
>
> Attachments: Modal.png, project.tar.gz, quickstart-closeDoesntWork.zip
>
>
> I have a panel in my modal window. I have a button in my panel that closes
> the modalwindow.
> If I use an indicatingajaxbutton for that button, the modalwindow does not
> close properly.
> However if i use an ajaxlink, things go smoothly.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.