Foren

Accessing A.Dialog from an iframe inside the dialog

thumbnail
Adrian Rodriguez Monedero, geändert vor 12 Jahren.

Accessing A.Dialog from an iframe inside the dialog

New Member Beiträge: 15 Beitrittsdatum: 17.10.10 Neueste Beiträge
Hello,

I just built a pop-up dialog using the technique described here: http://www.liferay.com/es/web/raymond.auge/blog/-/blogs/10429321, and I was wondering how to access the A.Dialog object from within the javascript code in the Iframe.

So far I managed to do it with
parent.myDialog
, but this requires to know the name of the dialog attribute in the window object. I tried with
this
, but it didn't work.

Thanks!
thumbnail
jelmer kuperus, geändert vor 12 Jahren.

RE: Accessing A.Dialog from an iframe inside the dialog

Liferay Legend Beiträge: 1191 Beitrittsdatum: 10.03.10 Neueste Beiträge
Unless the dialog is modal you can have multiple dialog's open, so the iframe can impossibly know which dialog to target without also knowing the id
thumbnail
Adrian Rodriguez Monedero, geändert vor 12 Jahren.

RE: Accessing A.Dialog from an iframe inside the dialog

New Member Beiträge: 15 Beitrittsdatum: 17.10.10 Neueste Beiträge
Thanks!

So, I reformulate the question and the approach.

Is it possible to pass the A.Dialog to the iframe? Given a method in the Iframe code:


function myDialog_setDialog(dialog){
  //.. Now I have it!
}


How should I call this method? Probably in a callback of the class Plugin.Base, would be the best option. But which one? doAfter? afterHostMethod?

Regards,
Adrián Rodríguez
thumbnail
jelmer kuperus, geändert vor 12 Jahren.

RE: Accessing A.Dialog from an iframe inside the dialog

Liferay Legend Beiträge: 1191 Beitrittsdatum: 10.03.10 Neueste Beiträge
I guess you could use the contentWindow property of the iframe element to do that. You can just glue your dialog reference onto that