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
}
)
});
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值