2014-12-03 4 views
3

안녕하세요 간단한 페이지를 SharePoint 페이지 라이브러리에 업로드하고 긴 대기 대화 상자없이 장기 실행 작업을 시뮬레이션하려고합니다. 다음은 내가 가지고있는 스크립트입니다Sharepoint2013 모달 대화 상자가로드되지 않습니다.

<script type="text/javascript"> 
    var waitDialog = null; 
    function DoWork() { 
     toggleProcessingStatus(true); 
     UpdateUI(); 
     toggleProcessingStatus(false); 
    } 
    function UpdateUI() 
    { 
     var lblControl = document.getElementById("lbl"); 
     for (i = 0; i < 20000; i++) 
     {    
      lblControl.innerText = lblControl.innerText + i; 
     } 
    } 
    function toggleProcessingStatus(showStatus) { 
     if (showStatus) { 
      ExecuteOrDelayUntilScriptLoaded(ShowWaitDialog, "sp.js"); 
     } 
     else { 
      if (waitDialog != null) { 
       //setTimeout(CloseWaitDialog, 5000); 
       CloseWaitDialog(); 
      } 
     } 
    } 
    function ShowWaitDialog() { 
     waitDialog = SP.UI.ModalDialog.showWaitScreenWithNoClose('Updating...', 'Please wait while update completes...', 150, 330); 
    } 

    function CloseWaitDialog() { 
     if (waitDialog != null) { 
      waitDialog.close(); 
     } 
    } 
</script> 
<input type="button" id="btnShowDialog" title="Do Long Running Work" name="Do Long Running Work" onclick="javascript: DoWork();" value="Do Long Running Work"/> 
Label: <label id="lbl" title="Test">Test Wait Screen</label> 

모든 도움을 주실 수 있습니다.

감사합니다, Mallikarjun

답변

0

ExecuteOrDelayUntilScriptLoaded (ShowWaitDialog, "sp.ui.js")을 시도;

0

"sp.ui.dialog.js"가로드되어야합니다.

나는 대화 상자를 열고 싶었던 curent 페이지에 아래 코드를 추가했습니다. 언급 된 다른 답변처럼

0

, 당신은 스크립트가 스크립트를로드 sp.ui.dialog.js 확인해야합니다. sp.ui.dialog 전에로드 될 때까지 기다립니다 - executeOrDelayUntilScriptLoaded

  • :이 패턴 모두 executeOrDelayUntilScriptLoadedexecuteFunc의 포함은 다음과 같은 보장

    SP.SOD.executeOrDelayUntilScriptLoaded(function() { 
        SP.UI.ModalDialog.showModalDialog(options); 
    }, "sp.ui.dialog.js"); 
    //ensure script is loaded 
    SP.SOD.executeFunc("sp.ui.dialog.js", null, null); 
    

    아래에 코드와 유사하여이 작업을 수행 할 수 있습니다 포함 된 코드 실행

  • executeFunc - sp.ui.dialog가 이미로드 된 페이지인지 확인하십시오.
관련 문제