How to pass data between opener and opened window

Hi,

I enjoy dhtmlx components very much and this windows functionality is a little bit new for me. I struggle to find a way how to pass data between layout and newly created window.

I want to open new modal window that will show exception that is raised by our program but I do not know how to pass data.

I need to be able to do something like:

  1. pass data to some parent for example this.modalErrorWindow.exception = myException; and when I call this.modalErrorWindow.attachURL(‘dhtmlxErrorDialog.html’); I want to access it in onload method like for example using some notation like parent.exception

or

  1. to be able to execute javascript function that is programmed in attached url html page like for example this.modalErrorWindow.showException(exception);

In previous no dhtmlx solution I used dialog arguments but those are not used here.

Could you please point me to some direction if this is possible?

I even found some help page explaining some _frame object and I fail to execute on it function myFunc()
this.modalErrorWindow.attachURL(‘testerror.html’);
this.modalErrorWindow.show();
ifr = this.modalErrorWindow._frame;
ifr.contentWindow.msg = “Popup message”;
ifr.contentWindow.myFunc();
ifr.contentWindow.document.getElementById(“myDiv”).innerHTML = “Object on page”;

it seems to me that object is not loaded or it points somewhere else. Could you please help?

BR
Zdenek

Hi,

if you use the latest 2.6 version, you need to use getFrame() method instead of _frame property to access iframe object. Moreover, page content is available only after the page is loaded. So, you may set onload event handler in the page that you load by attachURL method and call the necessary functionality from it.

For me neither getFrame() nor _Frame seem to work.

Also I can’t seem to find getFrame in the docs.

Hi,

I was able to resolve my problems using data access on loaded page. This was an easiest option for me. I use on parent page global object Layout and using its stored data I was able to do what I needed.

I realized that this _frame works after the page is loaded.

Here is my sample code of data passing - accessing.

exception = parent.Layout.modalErrorWindow.exception;

Anyway it works so thank you for guidance.

to cioannou
It might be that you do not have your page completelly loaded or you use wrong naming convention: use _frame instead of _Frame or access data in loaded page using parent object

BR
Zdenek