在长时间的过程中显示处理消息/进度条 [英] Display Processing Message/ProgressBar during long time process

查看:67
本文介绍了在长时间的过程中显示处理消息/进度条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个页面,当它开始加载时,它将在很长时间内执行!
因此,页面在此期间为空.
我想添加一条处理消息(或进度条)
如何添加Jquery UI进度栏?
谢谢您

I have a page when it starts loading, it will perform in a long time process!
So, the Page is empty during this time.
I want to add a Processing Message (or a progress-bar)
How can I add a Jquery UI progress bar?
Thank You

推荐答案

要显示正确的进度条,您需要知道流程的完成程度(完成百分比),并报告此数字,以便客户可以更新它的酒吧.

这可能非常复杂-例如,如果您要调用一个可能花费一些时间的数据库过程,您如何知道db操作有多远以及需要多长时间才能完成? (有可能,只是很难!)

在这种情况下,您可能会发现只显示动画的请稍候"会更容易gif [^ ].这很简单,是一种让客户端知道该操作可能需要一些时间的公认方法.
To display a proper progress bar, you need to know how far through (percentage complete) your process is and report back this figure so that the client can update it''s bar.

This can be quite complex - for example, if you are calling a database procedure that can take some time, how do you know how far the db operation is and how long it would take to complete? (it''s possible, just difficult!)

In these situations, you might find it easier just to display a ''please wait'' animated gif[^]. It''s a lot simplier and is a recognised way of letting the client know that the operation might take some time.


我认为,可以通过以下方式在客户端屏幕上实现进度条通知服务器上长时间运行的任务.

1)为您所需的工作创建单独的任务,可以是线程工作或Web服务.
2)实现jQuery Ajax来调用该线程化的工作项/Web服务方法以运行功能.
3)使用jQuery函数,用正确的消息刷新客户端UI.

如果您要进行定性工作,则可以选择以百分比显示任务已完成,否则您可以只显示进度而不是百分比.

希望对您有所帮助.
I think in the following way to implement progress bar notifications on client screen for long running task on server .

1) create a separate task for your required work, could be a threaded work or on a web service.
2) implement jQuery Ajax to call that threaded work item/web service method to run a function.
3)using jQuery functions, refresh client UI with proper message.

There could be option to show task completed in percentage if you have qualitative work to do else you can simply show progress instead of percentage.

I hope it would be helpful.


这篇关于在长时间的过程中显示处理消息/进度条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆