access parent/opener window from dhtmlxwindow

Hi there,



I have dhtmlxwindow instance and there’s a close button inside it. I want if someone’s click the close button, i want the button to call a function on parent/opener window. I tried to use window.opener.myFunction() also tried opener.myFunction() and also tried window.dialogArguments.myFunction() but none of them are working



Can anyone help?



Thank you,

Leonard

The dhtmlxwindows are HTML constructs, they exists in same namespace as any other js code in window, so you can use the direct calls from them.

Instead of
    window.opener.myFunction
you can use just
    window.myFunction

It’s not working. I’m using attachUrl()- so the child is calling a function on the opener.

Also, it’s a bit weird. When I press close button on the window, it left me a div with class: .dhtmlx_winviewport on top of the page and this makes my application unclickable. Any idea why?

It’s not working. I’m using attachUrl()- so the child is calling a function on the opener.
If you attaching code to close event from main window, it will be executed in main window scoope, so you can use direct naming
If you executing code from window content , you can try to use window.parent.myFunction. Please beware that it will not work if master and child windows has content from different domains.

When I press close button on the window, it left me a div with class:
.dhtmlx_winviewport on top of the page and this makes my application
unclickable. Any idea why?
The only way to achieve similar situation - attach some custom code to events of window, which will throw error and break normal processing.
If problem still occurs for you - please send any kind of sample where problem can be reconstructed ( you can send it directly to support@dhtmlx.com )


Hi thanks for your reply;



here’s the code i’m using to create the window:



 function showEditWindow(){
  var dhxWins;
  var win;
 
  dhxWins = new dhtmlXWindows();
  win = dhxWins.createWindow(“ab”,0,0,800,600);
  win.attachURL(“<?= HTTP_CATALOG_SERVER?>address.book.explorer.php”);;
  win.denyResize(); // deny resizing
  win.setText(“Address book”);
  win.setModal(false);
  dhxWins.setImagePath(“<?= DIR_WS_JAVASCRIPT ?>dhtmlxWindows/codebase/imgs/”);
  dhxWins.setSkin(“standard”);
 }




i’m sure it’s pretty basic- it didnt throw any error. tried to add:



  win.attachEvent(“onClose”, function(){
   document.getElementBy(".dhtmlx_winviewport").style.display=“none”;
  });



but it didnt work


Please try to use attached js file instead of original one, it must not produce any additional elements, which may block normal activity.

dhtmlxwindows.zip (12.1 KB)

Thanks for your help- it’s working