一聚教程网:一个值得你收藏的教程网站

热门教程

ExtJs 4 FormPanel进度条(Wait mask)灰色蒙版不能正常隐藏的BUG

时间:2022-06-25 18:29:02 编辑:袖梨 来源:一聚教程网

首先必须知道例外两个方法 Ext.MessageBox.hide()和Ext.MessageBox.updateProgress(value,"ProgressText","msg")(三个参数,看名字就知道意思),
   注意value为0-1之间的数,表示进度条的进度.
第一种:(通过进度的大小控制进度,满进度为1)

代码

 代码如下 复制代码
function Read4() {
var progressBar=Ext.Msg.show({
title:"标题",
msg:"通过进度的大小来控制进度",
progress:true,
width:300
});
var count=0;
var bartext="";
var curnum=0;
Ext.TaskMgr.start({
run:function () {
count++;
if (count>=10) {
progressBar.hide();
}
curnum=count/10;
bartext=curnum*100+"%";
progressBar.updateProgress(curnum,bartext);
},
interval:1000
})
}


第二种:(通过固定时间控制进度加载)

代码

代码

 代码如下 复制代码
function Read5() {
var progressBar=Ext.Msg.show({
title:"标题",
msg:"通过固定时间完成进度",
width:300,
wait:true,
waitConfig:{interval:500,duration:5000,fn:function () {
Ext.Msg.hide();
}},
closable:true
});
 // setTimeout(function () {
 // Ext.Msg.hide();
 // },5000);
  }

 

动态更新进度信息

上面看上去很好但在实例应用中我发现,等待进度条(Wait mask)灰色蒙版不能正常隐藏的BUG,下面我修改了一下实例

 代码如下 复制代码

Ext.define('Ext.form.SubmitFix', {
    override: 'Ext.ZIndexManager',
 
    register : function(comp) {
        var me = this,
            compAfterHide = comp.afterHide;
      
        if (comp.zIndexManager) {
            comp.zIndexManager.unregister(comp);
        }
        comp.zIndexManager = me;
 
        me.list[comp.id] = comp;
        me.zIndexStack.push(comp);
      
        // Hook into Component's afterHide processing
        comp.afterHide = function() {
            compAfterHide.apply(comp, arguments);
            me.onComponentHide(comp);
        };
    },
 
    /**
    * Unregisters a {@link Ext.Component} from this ZIndexManager. This should not
    * need to be called. Components are automatically unregistered upon destruction.
    * See {@link #register}.
    * @param {Ext.Component} comp The Component to unregister.
    */
    unregister : function(comp) {
        var me = this,
            list = me.list;
      
        delete comp.zIndexManager;
        if (list && list[comp.id]) {
            delete list[comp.id];
          
            // Relinquish control of Component's afterHide processing
            delete comp.afterHide;
            Ext.Array.remove(me.zIndexStack, comp);
 
            // Destruction requires that the topmost visible floater be activated. Same as hiding.
            me._activateLast();
        }
    }
});

该BUG会在4.1.2版本中修正,提前修正的方法为将下面的补丁代码加入项目中:

 

热门栏目