2011-08-14 5 views
3

첫째, 여기 내 코드입니다 :두 번째 Ext.Msg가 첫 번째 메시지 바로 뒤에 닫히는 이유는 무엇입니까?

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 
}); 

내 문제는 내가 처음 메시지 박스에서 확인을 누르면, 두 번째는 두 번째 적은 다음 나타납니다 다음 날 두 번째에서 확인을 누르지 않고, 너무 닫이다 메세지 박스.

이상적으로는 당연히 동일한 사용자 이름과 비밀번호 입력을 동일한 Messagebox에 표시 하겠지만이를 수행하는 방법을 알 수는 없습니다.

모두에게 감사드립니다!

+0

thnx for asking! 응답을위한 – headkit

답변

11

호출중인 Ext.Msg의 정적 표시 방법은 기본적으로 이전 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 
}); 

, 난 당신이 두 필드를 포함하는 사용자 지정 양식 패널을하고 정보를 그런 식으로 수집에게 추천 할 것입니다.

희망이 도움이됩니다. 스튜어트

+0

thx! – headkit

관련 문제