功能结束后显示的MessageBox [英] MessageBox shown after function is over
本文介绍了功能结束后显示的MessageBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个JavaScript函数调用我的javascript函数,我的功能就是这样:
I have a javascript function that calls my javascript function, my func islike this:
function sugParitValidation(){
var isValid = false;
Ext.MessageBox.confirm(' ','Are you sure you want to do this?', function(btn){
if(btn == 'yes'){
isValid = true;
}
});
return isValid ;
}
我的问题是 - if语句和返回状态正在发生,只有在显示确认窗口之后。
这样我就不能对用户选择的内容做出反应。
如何解决?尝试全部使用setTimeOut,没有任何改变....
My problem is - if statement and the return statment is happening, and only after that the confirm window being shown. That way I can't react to what the user choosed. how to solve this? tried allready use setTimeOut, no change at all....
推荐答案
我想你正在尝试这样做。 / p>
i think you are trying to do something like this.
someFunction(){
if(sugParitValidation()){
//todo something
}
else{
//todo another thing
}
}
你可以轻松地用回调来做这个。这是一个例子。
you can do this easyly with callbacks. This is the example.
someFunction(){
var messageCallback = function(btn){
if(btn === 'yes'){
//todo something
}
else{
//todo another thing
}
}
Ext.MessageBox.confirm(' ','Are you sure you want to do this?',
messageCallback);
}
这篇关于功能结束后显示的MessageBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文