EasyUI Forum
May 14, 2024, 07:37:26 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: Close iframe window using link button [Solved]  (Read 6147 times)
Darrel
Jr. Member
**
Posts: 74


View Profile
« on: March 06, 2017, 02:54:23 AM »

Hello,

I have the following case where one page is loaded as an iframe in an easyui-window. The page loads as expected in the iframe. Everything works fine, the only issue being that I'm not able to close the iframe window on click of the button which is present in the frame. I am able to close the window using the close button on the title bar.
Reloado code example for the same is:
http://code.reloado.com/inepot3/3/edit#preview

As seen in the above reloado code, I need the iframe to close on click of the button as well.

I basically have a function that is called in the onBeforeClose event of the window, to help set some values to the main page before the window closes. This works fine with the close button on the title bar, but I can't seem to get it work with the link button as well Sad

Please could you tell me how can I close the window on click of the "Click To Close" button???

Regards,
Darrel
« Last Edit: March 06, 2017, 10:27:07 PM by Darrel » Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #1 on: March 06, 2017, 08:14:59 PM »

In your top page define a function as below:
Code:
function closeWin(){
   $('#dlg').window('close');
}

In your sub page in the iframe, call the 'window.top.closeWin()' function to close the top window.
Code:
$('#closeFrame').click(function(){
   window.top.closeWin();
});
Logged
Darrel
Jr. Member
**
Posts: 74


View Profile
« Reply #2 on: March 06, 2017, 10:26:53 PM »

Hello jarry,

Thanks a lot for your reply.

It worked as per the suggested changes Smiley

Regards,
Darrel.
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!