jQuery Window

Bind to the close event by type: jqxWindow. Author: http://jqwidgets.com

by redoak2000

HTML

<link rel="stylesheet" href="http://jqwidgets.com/public/jqwidgets/styles/jqx.base.css">
<link rel="stylesheet" href="http://jqwidgets.com/public/jqwidgets/styles/jqx.energyblue.css">
<script src="http://jqwidgets.com/public/jqwidgets/jqx-all.js"></script>
        <div id="dlgCGSQS">
            <div>
                Modal Window
            </div>
            <div>
                <div>
                    Please click "OK", "Cancel" or the close button to close the modal window. The dialog
                    result will be displayed in the events log.
                </div>
                <div>
                    <div style="float: right; margin-top: 290px;margin-right: 10px">
                        <input type="button" id="ok" value="OK" style="margin-right: 10px" />
                        <input type="button" id="cancel" value="Cancel" />
                    </div>
                </div>
            </div>
        </div>

TypeScript

var windowOptions: jqwidgets.WindowOptions = {
        position: { x: 50, y: 50 },
        showCollapseButton: true,
        maxHeight: 400,
        maxWidth: 700,
        minHeight: 400,
        minWidth: 700,
        height: 400,
        width: 700,
        resizable: true,
        draggable: true,
        isModal: true, modalOpacity: 0.3,
        autoOpen: true,
        okButton: $('#ok'), cancelButton: $('#cancel'),
        initContent: function () {
            var buttonOptions: jqwidgets.ButtonOptions = {
                width: '70px'
            };
            var okButtonInstance: jqwidgets.jqxButton = jqwidgets.createInstance('#ok', 'jqxButton', buttonOptions);
            var cancelButtonInstance: jqwidgets.jqxButton = jqwidgets.createInstance('#cancel', 'jqxButton', buttonOptions);
        }
    };
    
    var windowInstance: jqwidgets.jqxWindow = jqwidgets.createInstance('#dlgCGSQS', 'jqxWindow', windowOptions);
    //windowInstance.open();
    windowInstance.addEventHandler('close', function (event:any) {
    //alert("You closed a window");
        if (event.type === 'close') {
            if (event.args.dialogResult.OK) {
            alert("You OK a window");
            } else if (event.args.dialogResult.Cancel) {
            alert("You CANCEL a window");
            } else {
            alert("You closed a window");
            }
        }
    });