这就像确认框,它询问用户一些确认是否用户想要执行任务或拒绝或取消基于用户选择的任务不同的方法被调用。
语法
这里是简单的语法:
Ext.MessageBox.show({
title: 'Details',
msg: 'Please enter your details:',
width:300,
buttons: Ext.MessageBox.YESNOCANCEL // this button property for all three options YES, NO, Cancel.
});
例
下面是一个简单的例子显示用法:
<!DOCTYPE html>
<html>
<head>
<link href="./ext-6.0.0/build/classic/theme-classic/resources/theme-classic-all.css" rel="stylesheet">
<script src="./ext-6.0.0/build/ext-all.js"></script>
<script type="text/javascript">
Ext.onReady(function() {
Ext.create('Ext.Button', {
renderTo: Ext.getElementById('msgBox'),
text: 'Click Me',
listeners: {
click: function() {
Ext.MessageBox.show({
title: 'Details',
msg: 'Please enter your details:',
width:300,
buttons: Ext.MessageBox.YESNOCANCEL,
multiline: true,
fn: callbackFunction
});
function callbackFunction (){
Ext.Msg.alert('status', 'Details entered succesfully');
}
}
}
});
});
</script>
</head>
<body>
<p> Click the button for alert box </p>
<div id = "msgBox" ></div>
</body>
</html>
这将产生以下结果:
作者:terry,如若转载,请注明出处:https://www.web176.com/extjs_api/11692.html