1. #1
    Ext User
    Join Date
    Jan 2009
    Posts
    2
    Vote Rating
    0
    PlanetTechman is on a distinguished road

      0  

    Default [Solved] Closing Popup Ext.Window from within IFRAME html button

    [Solved] Closing Popup Ext.Window from within IFRAME html button


    I am having trouble figuring out how to close an Popup Ex.Window from within a page nested in a ManagedIFrame using a standard html button event.
    Have basic level knowledge with Java but slowly learning along with Ext so just need someone to finger point in a direction. My app has a mixture of Ext, ASS Classic and standard HTML.
    Am opening the popup via image link (see code below) which loads the Ext.Window and page url into the ManagedIFrame as specified by winURL. This all works fine.
    I would now like to close this window via an event on the Cancel button. I have tried various methods most resulting in “win is not define” etc.. which I understand as it can’t be seen I’m guessing. I’m not sure where to go next.
    Code:
    function showEditWindow(winTitle,winWidth,winHeight,winURL) {
           var win = new Ext.Window({
               title: winTitle,
               width: winWidth,
               height: winHeight,
               modal: 'true',
               layout: 'fit' ,
               items: [new Ext.ux.ManagedIFrame.Panel(
                       { 
                           defaultSrc:winURL,
                           loadMask: false
                       }
                     )]
               });
     
           win.show();
           return win;
       };
    Cheers
    Attached Images

  2. #2
    Sencha - Community Support Team hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,963
    Vote Rating
    10
    hendricd will become famous soon enough hendricd will become famous soon enough

      0  

    Default


    Quote Originally Posted by PlanetTechman View Post
    I am having trouble figuring out how to close an Popup Ex.Window from within a page nested in a ManagedIFrame using a standard html button event.
    Have basic level knowledge with Java but slowly learning along with Ext so just need someone to finger point in a direction. My app has a mixture of Ext, ASS Classic and standard HTML.
    Am opening the popup via image link (see code below) which loads the Ext.Window and page url into the ManagedIFrame as specified by winURL. This all works fine.
    I would now like to close this window via an event on the Cancel button. I have tried various methods most resulting in “win is not define” etc.. which I understand as it can’t be seen I’m guessing. I’m not sure where to go next.
    Code:
    function showEditWindow(winTitle,winWidth,winHeight,winURL) {
           var win = new Ext.Window({
               title: winTitle,
               width: winWidth,
               height: winHeight,
               modal: 'true',
               layout: 'fit' ,
               items: [new Ext.ux.ManagedIFrame.Panel(
                       { 
                           defaultSrc:winURL,
                           loadMask: false
                       }
                     )]
               });
     
           win.show();
           return win;
       };
    Cheers

    @PlanetTechman -- You would generally access the global namespace of the parent page via:

    window.top or window.parent

    Give your Ext Container (the Ext.Window) an ID so it can be found, making this possible:

    Code:
    button.onclick = function(e){
        var win = window.parent.Ext.getCmp('MIFWin');
        if(win)win[win.closeAction]();
       
    }
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  3. #3
    Ext User
    Join Date
    Jan 2009
    Posts
    2
    Vote Rating
    0
    PlanetTechman is on a distinguished road

      0  

    Thumbs up [SOLVED] Closing Popup Ext.Window from within IFRAME html button

    [SOLVED] Closing Popup Ext.Window from within IFRAME html button


    Works perfectly. All makes sense when I see it like that.
    Thank you Doug

  4. #4
    Sencha User
    Join Date
    Jun 2010
    Posts
    4
    Vote Rating
    0
    ibrapartage is on a distinguished road

      0  

    Default Many thanks

    Many thanks


    I have spent at least two days trying to find a way to close my popup window from a bbar CANCEL button. I did try many suggested options like findParentByType, Ext.getCmp('myWindow').close(), this.ownerCt.ownerCt.ownerCt.ownerCt.close(), ... Nothing seem to be working until I found this thread.
    This forun is so usefull and your contibution is helpful and greatly appreciated.
    Many thanks to all of you.
    Please continue your great works

  5. #5
    Sencha Premium Member
    Join Date
    Apr 2010
    Posts
    193
    Vote Rating
    25
    elgs will become famous soon enough elgs will become famous soon enough

      0  

    Default


    That's cool and is what I'm looking for. I believe this will open the door between extjs and other framework like jQuery or even plain javascript.
    Last edited by elgs; 19 Feb 2013 at 10:01 PM. Reason: typo

  6. #6
    Sencha Premium Member
    Join Date
    Apr 2010
    Posts
    193
    Vote Rating
    25
    elgs will become famous soon enough elgs will become famous soon enough

      0  

    Default


    Is it possible for the parent to access the components in the child? Say setting focus. Thanks.

  7. #7
    Sencha Premium Member
    Join Date
    Apr 2010
    Posts
    193
    Vote Rating
    25
    elgs will become famous soon enough elgs will become famous soon enough

      0  

    Default


    Quote Originally Posted by elgs View Post
    Is it possible for the parent to access the components in the child? Say setting focus. Thanks.
    I got answer to my own question after some investigation.

    Code:
    var ifrm = document.getElementById('signInIframe');
    ifrm = (ifrm.contentWindow) ? ifrm.contentWindow : (ifrm.contentDocument.document) ? ifrm.contentDocument.document : ifrm.contentDocument;
    var focusables = ifrm.Ext.ComponentQuery.query('textfield:focusable');
    if(focusables!==null&&focusables.length>0){
        focusables[0].focus(false, 200);
    }