Closing spModal via client Controller of the widget when server side return some action.

pandeyved
Tera Contributor

Hi All
I am using spModal to open a dialog box, just to show user that their request is being processed, and in server side the request is being processed once the all the server side action are completed then I want to close the spModal dialog box on it own, but I am not able to that.
Here is my code snippet:
client controller:

 c.confirmed = "asking";
            var warn = '<i class="fa fa-warning" aria-hidden="true"></i>';
            var msg = "${Are you sure you want to approve the selected approval requests ?}";
            spModal.open({
                title: "${Approval Confirmation}",
                message: warn + ' ' + msg,
                backdrop: 'static'
            }).then(function(confirmed) {
                if (confirmed) {
                    var processingDialog = spModal.open({
                        title: "Processing",
                        message: "Your request is being processed, please wait...",
                        backdrop: 'static',
                        buttons: []
                    });

                    c.data.action = "approve";
                    c.data.sysids = sysids;
                    c.server.update().then(function(response) {
                        c.data.action = undefined;
                        alert("Server update complete");
                        processingDialog.close();
                    });
                }
            });
Server update Complete is printing but it is not closing the dialog box. Is there any way to close it. Pls Guide.
Thanks
0 REPLIES 0