0
votes

...So I have code to open a Modal Window on a screen:

       var frmUpdateSuccessDiv = $('#frmUpdateSuccess').kendoWindow({
            height: "260px",
            width: "480px",
            title: false,
            modal: true,
            visible: false

        }).data('kendoWindow');

        frmUpdateSuccessDiv.center();
        frmUpdateSuccessDiv.open();

On the window is a button with id="uSuccess"

How do I code the jQuery to not only close the modal window, but the parent as well?

        $('#uSuccess').click(function () {
            $('#frmUpdateSuccess').closest(".k-window-content").data("kendoWindow").close();
        });

Isn't getting it done... and

        $('#uSuccess').click(function () {
            window.parent.close();
        });

only seems to work in IE (and throws up a big ugly warning that "the button wants to close the window, blah, blah...)

Ideas?

2

2 Answers

0
votes

Closing the modal window is $('#frmUpdateSuccess').data("kendoWindow").close(); (no closest(".k-window-content"))

So your button handler should be:

    $('#uSuccess').click(function () {
        $('#frmUpdateSuccess').data("kendoWindow").close();
    });

See it here: http://jsfiddle.net/OnaBai/BtSUQ/

But closing the window might be as easy as window.close() (not sure why you are trying using parent unless your code is inside an IFRAME) but in some browsers this will not work for security reasons (disallow web sites from playing with you windows / tabs).

0
votes

I'm not precisely sure what you are going for given the lack of context to your success window, but this code might get you down the right path. It allows a button on a window to close the containing window.

$(".close-button").click(function(){
    // call 'close' method on nearest kendoWindow
    $(this).closest("[data-role=window]").kendoWindow("close");
});