更改 ext.msg.confirmation 弹出窗口中的按钮文本
我想将文本从“是”更改为“是!!!”然后“不”对“不!!!”我尝试了很多东西但似乎没有任何效果 在 Sencha 上找不到任何相关文档,如果有人可以帮忙,谢谢
Ext.application({
name: 'Fiddle',
launch: function() {
Ext.Msg.confirm('Confirmation', "Do you want to cancel the order?", function(btnText){
//btnText = {
// yes: "YES!!",
// no: "NO!!"
//},
//btnText.setText("YESSS!!"),
if(btnText === "yes"){
Ext.Msg.alert("Alert", "You have cancelled the order.");
}
else if(btnText === "no"){
Ext.Msg.alert("Alert", "You have confirmed 'No'.");
}
}, this);
}
});
[解决方案]
Ext.application({
name: 'Fiddle',
launch: function() {
Ext.Msg.show({
title: 'Title',
message: 'Message',
buttons: {
yes: 'Cancel preAuth',
no: 'Cancel the whole order',
cancel: 'Do nothing!'
},
fn: function(buttonValue, inputText, showConfig) {
if(buttonValue === "yes"){
Ext.Msg.alert("Alert", "You have cancelled the order.");
}
else if(buttonValue === "no"){
Ext.Msg.alert("Alert", "You have confirmed 'No'.");
}
}, this);
}
});
I want to change the text from "yes" to "YES!!!" and "no" to "NO!!!" I tried many things but nothing seems to be working,
Couldnt find any documents on Sencha for this, if anyone can please help, Thank you
Ext.application({
name: 'Fiddle',
launch: function() {
Ext.Msg.confirm('Confirmation', "Do you want to cancel the order?", function(btnText){
//btnText = {
// yes: "YES!!",
// no: "NO!!"
//},
//btnText.setText("YESSS!!"),
if(btnText === "yes"){
Ext.Msg.alert("Alert", "You have cancelled the order.");
}
else if(btnText === "no"){
Ext.Msg.alert("Alert", "You have confirmed 'No'.");
}
}, this);
}
});
[Solution]
Ext.application({
name: 'Fiddle',
launch: function() {
Ext.Msg.show({
title: 'Title',
message: 'Message',
buttons: {
yes: 'Cancel preAuth',
no: 'Cancel the whole order',
cancel: 'Do nothing!'
},
fn: function(buttonValue, inputText, showConfig) {
if(buttonValue === "yes"){
Ext.Msg.alert("Alert", "You have cancelled the order.");
}
else if(buttonValue === "no"){
Ext.Msg.alert("Alert", "You have confirmed 'No'.");
}
}, this);
}
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
Ext.Msg.show
而不是Ext.Msg.confirm
,并为自定义按钮文本设置buttonText
。检查文档并尝试以下操作代码:Use
Ext.Msg.show
instead ofExt.Msg.confirm
, and setbuttonText
for custom button texts. Check docs and try the following code: