开发者

block ui goes too fast

Below is Jquery function through I'm calling a action in my asp.net MVC application. In controller action I'm loading a partial view, which is loade开发者_JS百科d in div "result". In controller action I'm performing a database operation and load a grid with these data...but we having huge records whick takes time (say for different situation it is 1-10 minute).

For better user experience, we decide to block the UI and show spinner before data loaded...

below blockui plugging works for me, but it is too fast..it show only for few seconds and then disappier...

how to avoid this..any idea..please help....

function RenderPartialView() {
    //block the UI until partial view is rendered
    $.blockUI({ message: '<h3><b><img src="/content/images/loading.gif" /> Please wait while the request is being processed...</b></h3>' });
    //load the partial view
    $('#result').load('@Url.Action("Grid", "Home")', { flip: false });
    //unblock the UI
    $.unblockUI();
}


Load has a callback you can access The provided callback is executed after post-processing has been performed (When a successful response is detected)

Try this instead of your last two commands:

//load the partial view
$('#result').load('@Url.Action("Grid", "Home")', { flip: false }, function(){
    //unblock the UI
    $.unblockUI();
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜