【发布时间】:2014-03-06 10:53:48
【问题描述】:
在我的 ExtJs 代码中,我正在检查警告标志的值。
如果设置了标志,我想向用户显示一个确认 (OKCANCEL) 框,我会在其中询问用户是否要继续,即使有警告。
现在就像任何确认框一样,如果用户单击“确定”,代码应该按顺序执行下一个命令,如果他单击“取消”,代码应该返回。
以下是我的代码:
if(warning){
Ext.MessageBox.show({
title: 'Icon Support',
msg: 'Are you sure you want to proceed?',
buttons: Ext.MessageBox.OKCANCEL,
icon: Ext.MessageBox.WARNING,
fn: function(btn){
if(btn == 'ok'){
// go to the alert statement below.
} else {
return;
}
}
);
alert('wants to proceed ahead'); //if user clicks OK then come here
}
现在我面临的问题是当代码进入if 块时,它会显示消息框,然后它会提醒wants to proceed ahead。
我可以通过在 alert() 之前添加 return; 语句来阻止这种情况发生。
但是当用户点击确定按钮后,我该如何进入alert语句呢?
【问题讨论】:
标签: javascript extjs callback