This is a tough one that's left me high and dry, because its a unique variation on a more common problem.
I have a modal parent window spawning a modal child window (with a standard window.showModal call to open it). The user performs some actions on this new page, and then closes it. On the close, I want to refresh the parent modal window.
What makes this tough is that both are modal. I've seen solutions for how to refresh normally (window.opener.location.refresh(true)) and if the child is a modal window (window.dialogArguments.location.reload(true); where the parent window is passed as the 2nd argument).
Any suggestions on what to do? I think the modal nature of the parent is breaking the refresh, and I can't figure out how to work around it.
When you open a Model window with window.showModalDialog the code in the parent page is stoped, so the code after the opening of the modal window won't be executed until the child is closed.
Having said that, just try:
// Open the modal dialog
window.showModalDialog('your/child/url.com')
// after is closed, the parent will refresh it self
window.location.reload();
Related
I know how to reload or refresh a parent window when we close child window using normal java script code.
But i don't know what is the best way for saving data into database after clicking submit button and same time how to close child window with reloading parent window.
In the same time the parent window will be effected by saving data from database.
And i am also trying to make a child window where the width and height will be proportional with parent window's size.
And when child window will be opened that time parent window will be totally disabled.
if someone helps me for doing it perfectly and following standard structure then it will be nice for me.
I'm working on a project which insists on using real modal windows. The current implementation works, it simply calls "showModalDialog" and uses the result that the dialog stores in "returnVal".
However, on Chrome, when you navigate to a different page, this functionality no longer works. It's a documented bug.
I'm changing it to use window.open. I can pass in a callback no problem... However, the popup window needs to be navigatable (it's to add an item to a DB, then return the items ID to the calling page). I can pass the callback in to the popup window, but when it navigates, I lose that callback...
Is there any way I can keep a pointer to a callback even when navigating to a new page in a popup window?
Open a frameset in the dialog, and in the frameset load the page in a frame.
When you navigate to the next page, it will be inside the frame, so the frameset stays the same and the returnVal is intact. You can access the return value using parent.returnVal from the frame.
I am opening a child window using the below code:
window.showModalDialog("FileUpload.aspx", "FileUpload",
"center:yes;resizeable=yes;dialogHeight:300px;dialogWidth:600px;");
I save the file uploaded in the child window(FileUpload.aspx)in its code behind FileUpload.vb page.
Since server side code, its postbacking and opening a new browser .
After my functionality in the child window, when I close it using below code,
window.open('', '_self', '');
window.close();
it is closing the new browser opened because of postback but a copy of the same child window is still open when returning to the parent page.
I want to close all the instances of this child window.
The showModalDialog method will freeze JavaScript execution on the parent window until the dialog that it opens has closed, so we can rule out that as the reason why your second window opens. When FileUpload.aspx posts back from the server, it should work the same way as modeless aspx postbacks.
I think you should be able to get rid of the window.open() method and you should be fine.
Parent window:
window.showModalDialog("FileUpload.aspx", "FileUpload",
"center:yes;resizeable=yes;dialogHeight:300px;dialogWidth:600px;");
The Child window will call this when it's done.
window.close();
I am rendering a html page that contains a button.
I have bind a method to browser window that opens a gwt popup when the button is invoked.
My problem is, when i scroll the page, the popup stays fixed and the page scrolls. I want the popup to be scrolled along with the html page.
Also, the user should not be allowed to access other parts of app when the popup is open.
Can somebody help me
Assuming you are using the PopupPanel class, it is as easy as calling the right constructor:
PopupPanel(boolean autoHide, boolean modal)
autoHide - true if the popup should be automatically hidden when the user clicks outside of it or the history token changes.
modal - true if keyboard or mouse events that do not target the PopupPanel or its children should be ignored
So if you set the modal parameter, you cannot click outside of the popup, and also the scroll event should not happen at all (that is somewhat right, as scrolling a popup with a fixed positioning doesn't make much sense... Oh well, for a non advertising purpose at least).
The work flow is like this, from my page, I created a popup using window.open method, then open other popup from that window and close its immediate parent, and I need to refresh the first parent page from this popup. I tried in different ways, but the window.opener method can't get the parent windows property.
Can anyone help me to solve this?