EasyUI Forum
September 14, 2025, 03:45:27 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Closing a Window  (Read 19720 times)
essco
Newbie
*
Posts: 9


View Profile Email
« on: October 10, 2014, 05:44:47 PM »

Gentlepersons...

I have a window in which I open another window consisting of a particular web page.  When I click on the button to "close" the web page the window stays open.  How does the child program "tell" the parent program to close himself(the child)?

Charlie
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: October 10, 2014, 06:36:43 PM »

When clicking the 'close' button on the window header, the 'onClose' event fires, in which you can call 'close' method to close another window.
Code:
$('#w2').window({
onClose: function(){
$('#w1').window('close')
}
})
Logged
essco
Newbie
*
Posts: 9


View Profile Email
« Reply #2 on: October 10, 2014, 07:46:40 PM »

Thank you much for your reply... however I guess I am having trouble explaining myself:

   +-------------------------------------------------+
   | Window 1                                          -- BX |
   +-------------------------------------------------+
   |                                                                 |
   |   +--------------------------------------+        |
   |   | Window 2                            -- BX|         |
   |   +--------------------------------------+        |
   |   |                                                   |        | 
   |   |                                                   |        |
   |   |                                                   |        |
   |   |                                   +---------+|        |
   |   |                                    |CANCEL ||        |
   |   |                                   +---------+|        |
   |   +---------------------------------------+       |
   +-------------------------------------------------+

Now, window 1 creates window 2 dynamically and a web page is loaded.  For purposes of argument lets say the user is asked for a password.  If the user does not want to continue, the user clicks on the Cancel Button.  If the page was running by itself, not in an iframe inside a window the routine would issue a self.close and all is done.  However, when I do that in this scenario the window 2 stays.  So how do I close window 2 from window 2.  I have tried calling a subroutine (e.g.  window.parent.runSomething("CLOSEME")  )  but I do not get an error and the winow just sits there.  The runSomething function is in the <head> section of the windows 1 program which dynamically built the second window.  I think the problem is with the IFrame but I really haven't been able to figure it out.

Once again thank you for your timely reply

Charlie           
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 on: October 10, 2014, 07:57:34 PM »

You may need to explain what your window is. Is it a browser window or a easyui window? Posting some code snippets may be more appropriate.
Logged
essco
Newbie
*
Posts: 9


View Profile Email
« Reply #4 on: October 10, 2014, 10:56:16 PM »

Thank you for answering...

It is an Easy-UI window:

     <div id="xx" class="easyui-window" ......>
          <iframe scrolling="auto" frameborder="0"  src="http://....." style="width:100%;height:100%;"></iframe
     </div>

This was the only way I could figure to load an html page into a window.  Also these lines are generated in "real time" and appended to the parent window (also an easy-ui window).

Charlie
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #5 on: October 10, 2014, 11:54:33 PM »

It is easy to load a html page into the window, just set the 'href' property.
Code:
<div id="xx" class="easyui-window" href="..." ......>
</div>

The window plugin extends from panel plugin, it has all the features defined in panel plugin. Please refer to this example http://www.jeasyui.com/demo/main/index.php?plugin=Panel&theme=default&dir=ltr&pitem=Load%20Content
Logged
essco
Newbie
*
Posts: 9


View Profile Email
« Reply #6 on: October 11, 2014, 07:10:23 AM »

Once again, thank you so much for your help....but...
Using the panel and refresh seems to work fine...but...
I cannot access any javascript functions in windows 2 it tells me


ReferenceError: ESSSMaybe is not defined

of course it is, and when I run the HTML not in a window, all is fined.

I am close, please continue to help

Charlie
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #7 on: October 12, 2014, 05:19:40 PM »

By default, the panel only extracts the <body> of content page, the <head> will be discarded. To let your script functions to be loaded into a panel, please move the <script> tags to the <body>.
Logged
essco
Newbie
*
Posts: 9


View Profile Email
« Reply #8 on: October 16, 2014, 04:46:10 PM »

Thank you so much for your kind reply...

Moving scripts to the body section of a form becomes a cumbersome task, and negates loading a page not written by me.

Charlie

p.s. This is not meant to be argumentative just true.  I do not need a reply.  Consider this closed.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!