`
zhcl321
  • 浏览: 25112 次
  • 性别: Icon_minigender_1
  • 来自: 西安
社区版块
存档分类
最新评论

Ext Msg 的常用方法

    博客分类:
  • Ext
阅读更多
	Ext.onReady(function(){
		//Ext.Msg.alert("title","Hello World");
		
		//带多个按钮的弹框 
		/*
		Ext.Msg.show({
			title:"Miltion",
			msg:"hava you seen my stapler?",
			buttons:{
				yes:true,
				no:true,
				cancel:true
			}
		});
		*/
		
		//自定义按钮显示内容 
		/*Ext.Msg.show({
			title:"Miltion",
			msg:"hava you seen my stapler?",
			buttons:{
				yes:'mayBe',
				no:'no',
				cancel:'cancel'
			},
			fn:function(btn){
				//这个会弹出yes、no、cancel,而不是maybe等 
				Ext.Msg.alert("you clicked :", btn);
			}
		})*/;
		
		//prompt、wait的使用
		/*Ext.Msg.show({
			title:"Miltion",
			msg:"hava you seen my stapler?",
			buttons:{
				yes:'mayBe',
				no:'no',
				cancel:'cancel'
			},
			fn:function(btn){
				//这个会弹出yes、no、cancel,而不是maybe等 
				//Ext.Msg.alert("you clicked :", btn);
				switch(btn){
				case "yes":
					Ext.Msg.prompt("miltion","where is it?",function(btn,text){
						if(btn=="ok"){
							Ext.Msg.alert("miltion","您输入了 :"+text);
						}
					});					
					break;
				case "no":
					break;
				case "cancel":
					Ext.Msg.wait("saving....","fileCopy",{
						text:'processing',
						duration:2700,   //进度条在被重置前运行的时间
						interval:300,        //进度条的时间间隔
						increment:10,      //进度条的分段数量
						fn:function callback(){
							alert('complete');
							//任务执行完成后,将窗口隐藏 
							Ext.Msg.hide();
							}
						})
					break;
				}
			}
		})*/
		
		//进度条自动更新,并计算进度  
		var msgBox = Ext.Msg.show({
			title:"miltion",
			msg:"update text",
			modal:true,
			width:300,
			progress:true
		})
		var count = 0;//滚动条被刷新的次数
		var percentage = 0;//进度百分比
		var progressText = "";//进度条信息 
		
		Ext.TaskMgr.start({
			run:function(){
				count++;
				if(count>10){
					msgBox.hide();
				}
				percentage = count/10;
				progressText = "now:"+percentage*100+"%";
				msgBox.updateProgress(percentage,progressText,'now Date:'+new Date().format('Y-m-d g:i:s A'));			
			},
			interval:1000
			}
		)
	});
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics