1.确认对话框
Ext.MessageBox.alert( title,content,fn)
Ext.onReady(function () {
Ext.Msg.alert("好吧,成功", "yahoo!ExtJs",fn);
});
Ext.Msg.alert("好吧,成功", "yahoo!ExtJs",fn);
});
2.选择对话框
Ext.MessageBox.confirm(title,content,fn)
回调函数接收参数e,表示按钮,e='yes'或='ok'(不区分大小写)都说明用户点击了确定。
//此方法提示确认和取消,如果将此方法放在函数中执行则出现在confirm方法后的代码永远不会执行,所以以后的操作逻辑必须放入fn回调函数,
Ext.Msg.confirm("", "确定删除此权限?", function (e) {
if (e != "yes") { return; }
//……此处执行操作
});
Ext.Msg.confirm("", "确定删除此权限?", function (e) {
if (e != "yes") { return; }
//……此处执行操作
});
3.输入数据对话框
Ext.MessageBox.prompt(title,content,fn,obj,m)
m:布尔值或数字(用以指示是否是多行或直接用数字指示多行的行数)
Ext);
});
});
4.自定义弹窗
Ext.MessageBox.show(options)
包含了以上弹出窗口的所有功能。
title:标题
msg:内容
multiline:行数
icon:Ext.MessageBox.ERROR | Ext.Msg.QUESTION
buttons: Ext.MessageBox.OKCANCEL | Ext.MessageBox.YESNOCANCEL
fn:function(e):回调时判断e值可知道用户点击的是哪个按钮,按钮小写的名字就是e的值。
,
icon: Ext.MessageBox.WARNING,
fn: function (m) {
if (m == "yes") {
Ext.Ajax.request({
method: "post",
url: "/StockTable/DelStockTable",
params: { ID: record.get("StockTableId"), delType: "Single" },
success: function (m) {
var m = Ext.decode(m.responseText);
Ext.Msg.alert("", m.msg);
Ext.getStore("StockTableStore").removeAt(rowIndex);
},
failure: function () {
Ext.Msg.alert("", "http错误");
}
});
}
}
});
icon: Ext.MessageBox.WARNING,
fn: function (m) {
if (m == "yes") {
Ext.Ajax.request({
method: "post",
url: "/StockTable/DelStockTable",
params: { ID: record.get("StockTableId"), delType: "Single" },
success: function (m) {
var m = Ext.decode(m.responseText);
Ext.Msg.alert("", m.msg);
Ext.getStore("StockTableStore").removeAt(rowIndex);
},
failure: function () {
Ext.Msg.alert("", "http错误");
}
});
}
}
});
进度条
Ext,//经过5000毫秒后停止
fn: function () {
Ext.MessageBox.hide();
}
}
});
});
fn: function () {
Ext.MessageBox.hide();
}
}
});
});
Ext);
}
});
}
});
5.遮罩
Ext.create('Ext.LoadMask', {//请求数据之前先定义一个等待蒙版
id: "mask",
msg: '处理中...',
target: Ext.getBody(),
autoShow: true
});
id: "mask",
msg: '处理中...',
target: Ext.getBody(),
autoShow: true
});
Ext.getCmp("mask").destroy();