最简单的对话框:
Ext.Msg.alert("提示", "保存失败");
含是否对话框:
Ext.MessageBox.confirm("注意", "是否继续?", function (btn) {
//返回的为no何yesif (btn == "yes") {
}
});
带输入的对话框:
Ext.MessageBox.prompt(
"标题",
"详细信息内容",
function (btn, text) {
Ext.Msg.alert("提示", "你点击了" + btn + "按钮,获取的文本:" + text);
},
this,
true, //表示文本框为多行文本框
"初始文本");
自定义对话框:
Ext.MessageBox.show({
title: "标题",
msg: "详细信息内容",
buttons: Ext.MessageBox.YESNOCANCEL, //对话框的按钮组合
multiline: false, //有文本框时,是否为多行文本框
closable: false, //是否可关闭
prompt: true,
icon: Ext.MessageBox.WARNING,//对话框类型,可以是提示警告等
iconCls: "add16",
width: 400
});
有进度条的对话框:
加载进度条
Ext.MessageBox.show({
title: '加载窗口',
msg: '详细信息内容',
progressText: '加载中...',
width: 300,
progress: true,
closable: false,
animateTarget: 'bt4'
});
//模拟加载环境
var f = function (v) {
return function () {
if (v == 12) {
Ext.MessageBox.hide();
Ext.Msg.alert("提示", "加载完毕!");
} else {
var i = v / 11;
Ext.MessageBox.updateProgress(i, Math.round(100 * i) + '% 完成');
}
};
};
for (var i = 1; i < 13; i++) {
setTimeout(f(i), i * 200);
}
等待进度条
Ext.MessageBox.show({
msg: '正在保存数据..',
progressText: '保存中...',
width: 300,
wait: true,
waitConfig: { interval: 200 },
icon: 'download',
animateTarget: 'bt5'
});
setTimeout(function () {
Ext.MessageBox.hide();
Ext.Msg.alert("提示", "保存完毕!");
}, 3000);