PDA

View Full Version : self close for dialog ?



TiGeR Wood
29 Jun 2007, 5:18 AM
Hi all,

I discover your site ... great ! thx for that :)

I have a dialog with an iframe as the body. In this iframe, i have some links.
I would like to click on one link and the dialog self close !!

I tried some things but no success ...

If anybody have ideas ...

Thanks in advance. :)

trbot
29 Jun 2007, 6:14 AM
javascript: parent.close();

TiGeR Wood
29 Jun 2007, 6:20 AM
Thanks for your reply,

parent.close() is simple function to close window.

If you look at the example for dialog, you have a "hello.js" file and in this file the dialog is called by some function and declared variable (dialog)

function called to close (on button) is dialog.hide ...

trbot
29 Jun 2007, 6:24 AM
Oh geez, I didn't get enough sleep last night.

The problem here is that you need to be able to get the ext dialog object in the parent frame. My guess is that Ext.get('...') only operates on the current page, and the iframe would be a different page.

If you were willing to resort to a css hack you could try hiding it by setting

parent.<dialog-id>.style.visible = false;

TiGeR Wood
29 Jun 2007, 7:37 AM
with css it works, but I don't have the animation to close window.
And more important, when I click on links inside iframe, the dialog top header (with cross) disappear ... So it's really important to really close the window and no just hidding it ...

I don't really need this iframe ... so if you have any solution whitout iframe ... i'm taking :)

thanks for help :)

trbot
29 Jun 2007, 8:30 AM
If you ditch the iframe and have access to the dialog object in JS, just call <dialog object>.hide.

I don't know why you would want to use an iframe anyway. Use AJAX to replace iframe src="..." and in a dialog it should be scrollable...

TiGeR Wood
29 Jun 2007, 8:44 AM
I tried to use your suggest ...

if I put dialog declaration in separate file and call the dialog-object.hide it won't works ...
but if I put dialog declaration in used file it works ... I don't know why ...

Thanks anyway :)