2010-02-02 3 views
0

내 함수에서 원하는 기능을 얻는데 문제가 있습니다. 기본적으로 AJAX 함수에 두 번 호출합니다 (Oracle APEX에서 제공 한대로 변경할 수는 없습니다).하지만 복용. 액션이 진행되는 동안 표준 AJAXy 회전 GIF를 보여주고 싶습니다. 그러나 운이별로 없습니다. 여기에 지금까지이 작업은 다음과 같습니다다음 Javascript 기능을 호출하기 전에 브라우저를 업데이트하려면 어떻게합니까?

function paginate(reportIDs, startRecord) 
{ 
//block access to the UI and show a "please wait" message 
    $.blockUI({ css: { 
      border: 'none', 
      padding: '15px', 
      backgroundColor: '#000', 
      '-webkit-border-radius': '10px', 
      '-moz-border-radius': '10px', 
      opacity: .5, 
      color: '#fff' 
     } }); 

    //make the two AJAX calls to the APEX provided function 
    for(var i = 0;i<reportIDs.length;i++) 
    { 
    $a_report(reportIDs[i], startRecord, ITEMS_PER_PAGE, ITEMS_PER_PAGE); 
    } 

    //clean up some APEX garbage on the page 
    formatPage(); 

    //make the "please wait" message go away 
    $.unblockUI; 
} 

나는 순간에 보내고있어 구체적인 문제는 UI의 차단이 AJAX 호출이 완료되면 단지 일어날 것으로 보인다는 것이다. 그렇다면 절대로 차단하지 마십시오 ... 어떤 아이디어입니까?

답변

2

이 다른 방법에 아약스를 감싸고 한 MS

function paginate(reportIDs, startRecord) 
{ 
    //block access to the UI and show a "please wait" message 
    $.blockUI({ css: { 
      border: 'none', 
      padding: '15px', 
      backgroundColor: '#000', 
      '-webkit-border-radius': '10px', 
      '-moz-border-radius': '10px', 
      opacity: .5, 
      color: '#fff' 
     } 
    }); 
    setTimeout(function(){ 
     //make the two AJAX calls to the APEX provided function 
     for(var i = 0;i<reportIDs.length;i++) 
     { 
      $a_report(reportIDs[i], startRecord, ITEMS_PER_PAGE, ITEMS_PER_PAGE); 
     } 

     //clean up some APEX garbage on the page 
     formatPage(); 

     //make the "please wait" message go away 
     $.unblockUI(); 
    }, 1); 
} 
+0

완벽한하여 해당 방법을 지연해야합니다 제안! 고맙습니다! –

0

호출이 async이라고 가정 할 때 - 콜백을 ajax 보고서 함수에 전달하거나 다른 함수 또는 상수를 사용하여 콜백을 설정할 수 있습니까? 그렇지 않으면 응답을 조사해야합니다. 응답 방법은 $a_report에서 반환 된 내용 및/또는 Ajax 기능 뒤에있는 API에 따라 다릅니다.

만약 그들이 async이 아니라면 오타 일 수 있습니다. 다른 포스터로 $.blockUI; 아마 $.blockUI();