[英]ExtJS 4.1: MessageBox 4 buttons
我试图为可关闭的MessageBox
使用4个按钮,并意识到close(x)按钮正在调用我的第4个按钮的自定义函数,而不是关闭对话框。
这是我的按钮配置:
{
ok : 'Action1',
yes : 'Action2',
no : 'Action3',
cancel : 'Action4'
}
处理程序代码:
fn : function(buttonId, text, option) {
switch (buttonId)
{
case 'ok' :
action1();
break ;
case 'yes' :
action2();
break ;
case 'no' :
action3();
break ;
case 'cancel' :
action4();
break ;
}
}
有什么帮助吗?
这是解决问题的方法。 我创建了带有4个按钮的新窗口作为默认的YESNOCANCEL窗口。
这是窗口的代码:
Ext.define('MyApp.view.MyWindow', {
extend: 'Ext.window.Window',
requires: [
'Ext.container.Container',
'Ext.Img',
'Ext.form.Label',
'Ext.button.Button'
],
autoShow: true,
border: false,
height: 165,
width: 329,
title: 'Save Changes?',
layout: {
type: 'vbox',
align: 'stretch'
},
initComponent: function() {
var me = this;
Ext.applyIf(me, {
items: [
{
xtype: 'container',
flex: 3,
margin: 5,
layout: {
type: 'hbox',
align: 'stretch'
},
items: [
{
xtype: 'image',
flex: 1,
height: 86,
padding: 15,
width: 113,
src: 'icon-question.png'
},
{
xtype: 'label',
flex: 3,
padding: '15 10 5 10',
text: 'You are closing a tab that has unsaved changes. Would you like to save your changes?'
}
]
},
{
xtype: 'container',
flex: 2,
padding: '10 5 10 5',
layout: {
type: 'hbox',
align: 'stretch'
},
items: [
{
xtype: 'button',
flex: 1,
margin: '0 5 0 0',
text: 'Yes'
},
{
xtype: 'button',
flex: 1,
margin: '0 5 0 0',
text: 'No'
},
{
xtype: 'button',
flex: 1,
margin: '0 5 0 0',
text: 'New Button'
},
{
xtype: 'button',
flex: 1,
text: 'Cancel'
}
]
}
]
});
me.callParent(arguments);
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.