Ext Msg 的常用方法

	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
			}
		)
	});

你可能感兴趣的:(ext,msg)