我有一个有点麻烦,从我得到的功能所需的功能......基本上,我做两个调用AJAX功能(如由Oracle APEX提供的,所以我不能改变这些),但他们”再服用一段时间。我想显示标准AJAXy纺纱GIF,而动作是怎么回事,但我没有多少运气。这是我到目前为止有:

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;
}

我目前遇到的具体问题是,用户界面的阻塞似乎一旦Ajax调用完成后只发生。然后,它从来没有放开...任何想法?

有帮助吗?

解决方案

包装你AJAX在另一种方法和延迟该方法由1毫秒

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);
}

其他提示

假设调用是async - 你可以传递一个回调到AJAX的报表功能,或者使用其他功能或常数设置回调?否则,你将有轮询响应 - 你会怎么做,这将依赖于从$a_report和/或落后于Ajax功能的API返回什么。

如果他们arent async那么它可能是一个错字或东西。至于其他的海报建议$.blockUI;大概应该是$.blockUI();

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top