jQWidgets Forums

jQuery UI Widgets Forums Dialogs and Notifications Window close window from button in iFrame

Tagged: 

This topic contains 2 replies, has 2 voices, and was last updated by  taraman 12 years, 2 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • close window from button in iFrame #16050

    taraman
    Member

    Hello,

    I have added a jqxWindow to my page.

    function windowScannedItems_init() {
    $("#windowScannedItems").jqxWindow({
    theme: theme,
    isModal: true,
    showCollapseButton: false,
    height: 600,
    width: 1100,
    maxWidth: 1100,
    autoOpen: false,
    modalOpacity: 0.5,
    resizable: false
    });
    };

    and set content to iFrame to open another page inside this window

     $("#windowScannedItems").jqxWindow('setContent', '<iframe src="ApproverScannedItems.aspx?SurgeryId=' + row.SurgeryId + '" width="100%" height="100%"></iframe>');
    $('#windowScannedItems').jqxWindow('open');

    there is a button in the page opened in the window

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title>Approver Scanned Items</title>
    </head>
    <body>
    <form id="frm" runat="server">
    <center>
    <div style="margin-bottom: 5px;margin-top: 5px">
    <div id="gridScanedItems"></div>
    </div>
    <input type="button" value="Approve" id="buttonApprove" />
    </center>
    </form>
    </body>
    </html>

    this button used to do some logic

    I need to make this button close the window after applying the logic.

    in other words, How can I access the element (window) in a parent page from a button inside its iFrame?

    close window from button in iFrame #16053

    Peter Stoev
    Keymaster

    Hi taraman,

    As far as I know, you cannot access HTML elements outside of an IFrame.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    close window from button in iFrame #16071

    taraman
    Member

    Hi Peter,
    I found a good solution:

    add a function to the parent window which has the logic to close the opening window

    function windowScannedItems_Close() {
    $('#windowScannedItems').jqxWindow("close");
    }

    and in page which is inside the iframe you can access this function and close the window:

    parent.windowScannedItems_Close();

    thanks,
    Taraman

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.