Extjs4 ExtJS 4.1:MessageBox 4按钮
我试图为一个可关闭的Extjs4 ExtJS 4.1:MessageBox 4按钮,extjs4,Extjs4,我试图为一个可关闭的MessageBox设置4个按钮,并意识到close(x)按钮正在调用我的第4个按钮的自定义功能,而不是关闭对话框 这是我的按钮配置: { ok : 'Action1', yes : 'Action2', no : 'Action3', cancel : 'Action4' } 处理程序代码: fn : function(buttonId, text, option) { switch (buttonId) {
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个按钮创建了一个新窗口作为默认的是取消窗口 下面是窗口的代码:
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);
}
})) 你需要更多的代码。触发功能的选择器是什么?为什么需要“是”和“确定”?如果您真的不需要它们,请使用以下命令:@Saki,通过使用
YESNOCANCEL
,我只得到3个按钮,但我需要4个buttons@C.Parcell,使用处理程序代码更新了原始问题。默认情况下,ExtJS使用3个按钮,如果需要更多,请使用4个按钮和消息创建新窗口。我会用图片给你答案。