vendredi 6 novembre 2015

Can I get a value returned from Close handler of a RadWindow?

I have a radwindow and it displays under a dialog. As you know, after closing this dialog, its ​Close handler function will be hit. In there, I return a boolean value. And my problem is that I want to get the return value directly from the Close handler without using any global flags.

Please reference the snippet code below to get more detail.

Function used for showing the dialog:

function showDialog() {
        var url = "ChildPage.aspx";
        var wnd = window.radopen(url, 'Child Dialog');
        wnd.set_modal(true);
        wnd.setSize(400, 120);
        wnd.set_minHeight(300);
        wnd.set_minWidth(100);
        wnd.set_destroyOnClose(true);
        wnd.set_keepInScreenBounds(true);
        wnd.set_overlay(false);
        wnd.set_visibleStatusbar(false);
        wnd.set_visibleTitlebar(true);
        wnd.add_close(closeChildDialogHandler); //closeChildDialogHandler is Close handler
        wnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Resize);
        wnd.show();
        wnd.center();
    }

And its Close handle function. As you see, I want to return true|false value in this handler.

function closeChildDialogHandler(sender, args) {
        var flag = false;
        var objConfirmSQ = args.get_argument();
        if (objConfirmSQ != null && typeof objConfirmSQ['returnValue'] != "undefined") {
            console.log("objConfirmSQ['returnValue'] = " + objConfirmSQ['returnValue']);
            return true;
        }
        else {
            return false;
        }
    }

OK, and is there any way I can receive the true|false value from the handler like this:

function myFunction(){
  var myVar = closeChildDialogHandler(unknown_param, unknown_param) //Not sure about this
}




Aucun commentaire:

Enregistrer un commentaire