Button 向按钮图标添加消息框
我试图在用户单击某个按钮时添加一个消息框。这是我的代码:Button 向按钮图标添加消息框,button,extjs,extjs4,messagebox,Button,Extjs,Extjs4,Messagebox,我试图在用户单击某个按钮时添加一个消息框。这是我的代码: { text: 'Button Icon', id: 'buttonIcon', cls: 'x-btn-text-icon', launch: function() { Ext.MessageBox.show({ title: "", msg: "Message Text", icon: Ext.MessageBox.
{
text: 'Button Icon',
id: 'buttonIcon',
cls: 'x-btn-text-icon',
launch: function() {
Ext.MessageBox.show({
title: "",
msg: "Message Text",
icon: Ext.MessageBox.WARNING,
buttons: Ext.MessageBox.OKCANCEL,
fn: function(buttonIcon) {
if (buttonIcon === "ok") {
alert("Done!")
}
}
});
}
}
现在,当你点击按钮图标时,什么也没发生,我需要它来显示我输入的信息。请提供帮助。按钮没有启动功能,您需要使用处理程序功能 像这样:
{
text: 'Button Icon',
id: 'buttonIcon',
cls: 'x-btn-text-icon',
handler: function() {
Ext.MessageBox.show({
title: "",
msg: "Message Text",
icon: Ext.MessageBox.WARNING,
buttons: Ext.MessageBox.OKCANCEL,
fn: function(buttonIcon) {
if (buttonIcon === "ok") {
alert("Done!")
}
}
});
}
}