admin管理员组文章数量:1333195
I need to create a function that returns a (boolean)result when the user clicks yes or no. I'm using a Ext.Msg.confirm
. Below my function (testcase).
function returnAnswer() {
Ext.Msg.confirm(
'HardCoded',
'Do you want hard-coded strings in your application?',
function(btn) {
return btn === 'yes';
}
);
}
In the above function a "callback" function returns a result and not my actual function.
How can I get returnAnswer
function return a result?
Thanks in advance.
I need to create a function that returns a (boolean)result when the user clicks yes or no. I'm using a Ext.Msg.confirm
. Below my function (testcase).
function returnAnswer() {
Ext.Msg.confirm(
'HardCoded',
'Do you want hard-coded strings in your application?',
function(btn) {
return btn === 'yes';
}
);
}
In the above function a "callback" function returns a result and not my actual function.
How can I get returnAnswer
function return a result?
Thanks in advance.
Share Improve this question edited Sep 18, 2024 at 16:32 A1rPun asked Feb 13, 2013 at 8:27 A1rPunA1rPun 16.9k8 gold badges59 silver badges92 bronze badges2 Answers
Reset to default 4returnAnswer
should pass a callback:
function returnAnswer(callback) {
Ext.Msg.confirm('HardCoded', 'Do you want hard-coded strings in your application?',
function(btn) {
callback.call(this, btn === 'yes');
});
}
You can use window.confirm()
it returns boolean value.
本文标签: javascriptExtMsgconfirm inside function return valueStack Overflow
版权声明:本文标题:javascript - Ext.Msg.confirm inside function return value - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742275394a2445098.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论