You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Makundi (JIRA)" <ji...@apache.org> on 2010/11/08 21:33:24 UTC

[jira] Commented: (WICKET-2053) Can't close modal panel inside modal page.

    [ https://issues.apache.org/jira/browse/WICKET-2053?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12929718#action_12929718 ] 

Martin Makundi commented on WICKET-2053:
----------------------------------------

Hi!

Is here a possible fix+patch for this problem: https://issues.apache.org/jira/browse/WICKET-3151

?


> Can't close modal panel inside modal page.
> ------------------------------------------
>
>                 Key: WICKET-2053
>                 URL: https://issues.apache.org/jira/browse/WICKET-2053
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-extensions
>    Affects Versions: 1.3.5, 1.4-RC1
>            Reporter: Yosi
>            Assignee: Matej Knopp
>
> I have ModalWindow showing a page containing anothor (child) ModalWindow showing a panel.
> When trying to close the inner panel ModalWindow wicket is trying to close the parent ModalWindow (page).
> I found the error in modal.js:
> ---------------------------------------------------
> Wicket.Window.close = function() {
> 	
> 	var win;
> 	try {		
> 		win = window.parent.Wicket.Window;
> 	} catch (ignore) {		
> 	}
> 	
> 	if (typeof(win) != "undefined" && typeof(win.current) != "undefined") {
> 		// we can't call close directly, because it will delete our window,
> 		// so we will schedule it as timeout for parent's window
> 		window.parent.setTimeout(function() {
> 			win.current.close();			
> 		}, 0);
> 	}
> }
> the following code seem to fix it:
> ---------------------------------------------------
> Wicket.Window.close = function() {
> 	var win;
> 	try {
> 		win = window.parent.Wicket.Window;
> 	} catch (ignore) {
> 	}
> 	if (typeof(win) == "undefined" || typeof(win.current) == "undefined") {
> 		try {
> 			win = window.Wicket.Window;
> 		} catch (ignore) {
> 		}
> 	}
> 	if (typeof(win) != "undefined" && typeof(win.current) != "undefined") {
> 		if (win.current.content.tagName.toLowerCase() == 'iframe') {
> 			var innerWin = win.current.content.contentWindow.Wicket.Window;
> 			if (innerWin && innerWin.current) {
> 				win = innerWin;
> 			}
> 		}
> 		var close = function(w) {
> 			w.setTimeout(function() {
> 				win.current.close();
> 			}, 0);
> 		};
> 		try {
> 			close(window.parent);
> 		} catch (ignore) {
> 			close(window);
> 		}
> 	}
> };

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.