0

I would like to show SP.UI.ModalDialog until I process and bind the data to data table. Can any one please do let me know what's wrong in it.

$(document).ready(function() {
    //alert("Hello World");
    var dialog = SP.UI.ModalDialog.showWaitScreenWithNoClose('Processing...', 'Request is in progress...' );
        function1();function2();function3();
        dialog .close();
    });
Ax Learner
  • 31
  • 3

1 Answers1

2

Try this,

    function RequestEnded() {
        try {
            waitDialog.close();
            waitDialog = null;
        } catch (ex) {}
    };

    function RequestStarted() {
        ExecuteOrDelayUntilScriptLoaded(ShowWaitDialog, "sp.js");
    };

    function ShowWaitDialog() {
        try {
            if (waitDialog == null) {
                waitDialog = SP.UI.ModalDialog.showWaitScreenWithNoClose('Processing...', 'Please wait while request is in progress...', 76, 330);
            }
        } catch (ex) {}
    };

    function BindTable() {
        RequestStarted();
        //Logic to bind the table
        RequestEnded();
    }

Ref: Use showWaitScreenWithNoClose How to open or close SP.UI.ModalDialog.showWaitScreenWithNoClose

All the best!!!