客户端代码:

      Ext.onReady(function () {
Ext.get('mb').on('click', function () {
Ext.Ajax.request({
url: root + "/Test/GetCount",
success: function (response) {
var sum = response.responseText;
Ext.MessageBox.show({
title: '删除',
msg: '正在删除...',
progressText: '',
width: 300,
progress: true,
closable: false,
animateTarget: 'mb'
});
f(sum);
},
failure: function () {
}
});
});
});
function f(v) {
Ext.Ajax.request({
url: root + "/Test/GetCurrentCount",
success: function (response) {
var curnum = response.responseText;
if (curnum == 0) {
Ext.MessageBox.hide();
}
else {
var i = (v - curnum) / v;
Ext.MessageBox.updateProgress(i, Math.round(100 * i) + '% completed');
setTimeout(f(v), 1000);
}
}
});
}

服务端耗时任务:

 public class TestController : Controller
{
private static int _count = ;
public int GetCount()
{
_count = ;
ThreadStart ts = new ThreadStart(RunBackThread);
Thread td = new Thread(ts);
td.Start();
return _count;
}
public int GetCurrentCount()
{
return _count;
}
public void RunBackThread()
{
while (_count > )
{
Thread.Sleep();
_count--;
}
}
}

ExtJs 进度条(轮询)的更多相关文章

  1. 使用viewpager实现广告条轮询的效果

    先上效果图: viewpager是google在v4-support包中提供的,使用时与listview类似,度需要提供一个adapter, 只不过viewpager提供的是PagerAdapter ...

  2. 进度条轮播【BackgroundColor】

    直接贴代码先看 HTML: <div class="bannar"> <div class="img"> <ul> < ...

  3. 实用ExtJS教程100例-003:进度条对话框Ext.MessageBox.progress

    在上一篇内容中我们介绍了三种常用的MessageBox提示框,在这篇文章中,我们将演示如何在对话框中使用进度条. 进度条对话框 我们可以使用下面的代码来在MessageBox中显示一个进度条: Ext ...

  4. .NET 请求被挂起,前端轮询,委托

    起因:因项目需要监控方法中计算进度,故而想通过AJAX调用,返回前端显示进度,结果开发中遇到第二个AJAX请求被挂起,需要等到第一个请求(计算)完成后,才会被处理到. 百度种种,知其原因是在Sessi ...

  5. Extjs 使用fileupload插件上传文件 带进度条显示

    一.首先我们看看官方给出的插件的解释: 一个文件上传表单项具有自定义的样式,并且可以控制按钮的文本和 像文本表单的空文本类似的其他特性. 它使用一个隐藏的文件输入元素,并在用户选择文件后 在form提 ...

  6. js动画 无缝轮播 进度条 文字页面展示 div弹窗遮罩效果

    1.无缝轮播 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.a ...

  7. HTML DOM部分---做竖向横向的下拉导航 下拉菜单 图片轮播(圆点、箭头) 选项卡 进度条;

    1,竖向下拉导航 鼠标单击打开 再打击关闭 <style> *{ margin:0px auto; padding:0px;} div{ width:100px; height:50px; ...

  8. 2014年12月20日00:33:14-遮罩+进度条-extjs form.isvalid

    1.Extjs : 遮罩+进度条 2.Extjs: extjs form.isvalid http://stackoverflow.com/questions/19354433/extjs-form- ...

  9. Extjs实现进度条

    做Extjs开发中,往往后台程序可能要执行一段时间才能得到返回结果,加入进度条可以提高客户体验度,以下为两种便捷的方式: 1.提交数据前用Ext.Msg.wait('提示','正在处理数据,请稍候') ...

随机推荐

  1. php 笔试题

    1.用PHP打印出前一天的时间格式是2006-5-10 22:21:21 解:echo date(‘Y-m-d H:i:s’, strtotime(‘-1 day’)); 原因: format 字符说 ...

  2. easyui-window 关闭事件,只要关闭窗口就会触发

    $(function () {            $('#windowsMSG').window({                onBeforeClose: function () { //当 ...

  3. command 'x86_64-linux-gnu-gcc' failed with exit status 1错误及解决方案

    Ubuntu16.04安装Scrapy(pip install Scrapy)时提示错误如下: Failed building wheel for cryptography Running setup ...

  4. 20161127-adt bundle

    1.adt.exe 路径:E:\software\adt-bundle-windows-x86-20131030\sdk\platform-tools\adt.exe 配置环境变量 命令: adb d ...

  5. qt creator 使用Ui文件的问题

    一.显式地调用uic.exe 如何将UI文件生成头文件 1,将设计的UI文件拷贝到uic.exe的目录下Qt\Qt5.3.2\5.3\mingw482_32\bin. 2, 打开windows的CMD ...

  6. Codeforces Round #388 (Div. 2) A,B,C,D

    A. Bachgold Problem time limit per test 1 second memory limit per test 256 megabytes input standard ...

  7. CentOS6.5 简单配置Nginx + tomcat

    1.配置nginx.conf vi /usr/local/nginx/conf/nginx.conf --这是你的安装目录 注:红框地方为任意位置,server在配置文件中已存在 我使用的是两个tom ...

  8. js 定义方法的集中方式

    1:调用关键字function来构造 如:    function  distance(x1,x2,y1,y2)    {    var  dx = x2 - x1;    var  dy = y2  ...

  9. python走起之第八话

    1. Socket介绍 概念 A network socket is an endpoint of a connection across a computer network. Today, mos ...

  10. Redis使用系列目录(一)

    环境介绍 Redis 安装 Redis配置文件详解 Redis主从复制搭建 Redis集群环境搭建 Redis高可用