【问题标题】:Closing showWaitScreenWithNoClose in SharePoint CSOM在 SharePoint CSOM 中关闭 showWaitScreenWithNoClose
【发布时间】:2014-11-03 09:03:14
【问题描述】:

我正在使用 REST API 创建一个列表。在我的 JavaScript 代码中,我编写了如下内容:

// If I declare 'waitDialog' then it is not get closed by 
// calling 'waitDialog.close()'. Without any declaration it works.
var waitDialog;

function createList() {

    // Show wait dialog
    waitDialog = SP.UI.ModalDialog.showWaitScreenWithNoClose("Please wait...", "Please wait...", 100, 300);

    jQuery.ajax({
        // List data
        },
        success: doSuccess,
        error: doError
    });
}

function doSuccess(data) {
    waitDialog.close(); // Close wait dialog
}

function doError(data, errorCode, errorMessage) {
    waitDialog.close(); // Close wait dialog
}

如果我用声明var waitDialog; 声明waitDialog,那么调用waitDialog.close()工作。没有任何声明它就可以工作并且对话框关闭。我发现 this question 详细说明了使用 var 之间的区别,但没有什么可以澄清这种情况。

知道为什么它在没有声明而不是声明的情况下工作吗?

【问题讨论】:

    标签: javascript rest sharepoint csom sharepoint-clientobject


    【解决方案1】:

    我无法重现您的声明问题。 我注意到一件事......我相信您需要将 SP.UI.DialogResult 枚举传递给 close 方法

    waitDialog.close(SP.UI.DialogResult.OK);
    

    【讨论】:

      【解决方案2】:

      //显示和隐藏等待它的javascript

      function waitMessage() {
          window.parent.eval("window.waitDialog = SP.UI.ModalDialog.showWaitScreenWithNoClose('Processing...', '', 90, 300);");
      }
      
      function closeMessage() {
          if (window.frameElement != null) {
              if (window.parent.waitDialog != null) {
                  window.parent.waitDialog.close();
              }
          }
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-01-03
        • 2017-04-04
        • 2014-06-19
        • 2021-10-22
        • 2023-03-19
        • 1970-01-01
        相关资源
        最近更新 更多