首先,这是我的代码:
Ext.Msg.show({
title: 'Username',
msg: 'Please enter your username',
buttons: Ext.MessageBox.OKCANCEL,
prompt:{ maxlength : 180, autocapitalize : false },
modal: true,
fn: function(buttonId, text) {
console.log("OK ("+text+"), what is you password?");
if (buttonId == 'ok')
{
Ext.Msg.show({
title: 'Password',
msg: 'Please enter your password',
buttons: Ext.MessageBox.OKCANCEL,
prompt:{ maxlength : 180, autocapitalize : false },
modal: true,
fn: function(buttonId2, text2) {
if (buttonId == 'ok')
{
console.log("OK ("+text+", "+text2+"), attempting login..");
}
},
icon: Ext.MessageBox.INFO
});
}
},
icon: Ext.MessageBox.INFO
});
Run Code Online (Sandbox Code Playgroud)
我的问题是,当我在第一个消息框上按OK时,第二个消息显示不到一秒然后关闭,没有我在第二个消息框上按OK.
当然,理想情况下,我会在同一个Messagebox中显示用户名和密码输入,但我无法弄清楚如何执行此操作.
所有帮助赞赏!
Stu*_*art 11
您正在调用的Ext.Msg上的静态show方法基本上重新配置了以前的MessageBox,因此在隐藏和再次显示时会感到困惑.
您应该创建Ext.MessageBox类的新实例并调用该对象的show方法,以便它将使用独立实例.
var msg = new Ext.MessageBox().show({
title: 'Username',
msg: 'Please enter your username',
buttons: Ext.MessageBox.OKCANCEL,
prompt:{ maxlength : 180, autocapitalize : false },
modal: true,
fn: function(buttonId, text) {
console.log("OK ("+text+"), what is you password?");
if (buttonId == 'ok')
{
var msg2 = new Ext.MessageBox().show({
title: 'Password',
msg: 'Please enter your password',
buttons: Ext.MessageBox.OKCANCEL,
prompt:{ maxlength : 180, autocapitalize : false },
modal: true,
fn: function(buttonId2, text2) {
if (buttonId == 'ok')
{
console.log("OK ("+text+", "+text2+"), attempting login..");
}
},
icon: Ext.MessageBox.INFO
});
}
},
icon: Ext.MessageBox.INFO
});
Run Code Online (Sandbox Code Playgroud)
虽然这有效,但我建议你制作一个包含两个字段的自定义表单面板,并以这种方式收集信息.
希望这可以帮助.斯图尔特
| 归档时间: |
|
| 查看次数: |
3307 次 |
| 最近记录: |