Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by E Leonard on Apr 11, 2008 06:53
open dhtmlx forum
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
Answer posted by Stanislav on Apr 14, 2008 06:22
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
Answer posted on Apr 15, 2008 02:15
It's not working. I'm using attachUrl()- so the child is calling a function on the opener.
Answer posted on Apr 15, 2008 02:45
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?
Answer posted by Support on Apr 15, 2008 03:14
>>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.
Answer posted by Support on Apr 15, 2008 03:19
>>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 )
Answer posted on Apr 15, 2008 08:41

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

Answer posted by Support on Apr 15, 2008 09:15
Please try to use attached js file instead of original one, it must not produce any additional elements, which may block normal activity.
Attachments (1)
Answer posted on Apr 16, 2008 01:55
Thanks for your help- it's working