简体   繁体   中英

ExtJs 4.2 nested prompt message box

I have a code which looks like this:

        Ext.Msg.prompt( Translation.RefusalMessageBoxTitle, "", 
            function(btn, text, cfg ){

                if(btn == 'ok' && Ext.isEmpty(text)) {
                    var newMsg = '<span style="color:red;" class="error">' + Translation.RefusalMessageBoxEmpty + '</span>';
                    Ext.Msg.show(Ext.apply({}, { msg: newMsg }, cfg));
                }else if( btn !== 'ok' ){
                    return;
                }else if( btn == 'ok' ){
                    this.sendRefusalAnswer( methodName, text, "reject", Constant.DocumentStatus.REFUSED, me.selectedDocument.get('id'));
                }

            }, this, true, '' );

Now mz problem is that the

 var newMsg = '<span style="color:red;" class="error">' + Translation.RefusalMessageBoxEmpty + '</span>';
                        Ext.Msg.show(Ext.apply({}, { msg: newMsg }, cfg));

part of the code gets executed, but then the box closes imidietly... how can i prevent that??? any ideas?

EDIT:

This happens only on EXTJS 4.2 build Build date: 2013-03-11 22:33:40 (aed16176e68b5e8aa1433452b12805c0ad913836) ONLY!!!!!

the version Build date: 2013-05-16 14:36:50 (f9be68accb407158ba2b1be2c226a6ce1f649314) works just fine °-°

Don't use the Ext.Msg singleton, but rather regular windows or create multiple instances of Ext.window.MessageBox yourself. The singleton is itself a window, and the component is shared by all calls to alert , confirm , prompt , etc., so it won't be possible to show multiple windows at the same time with it.

I converted it to a message object:

        Ext.Msg.show({ 

            title: Translation.RefusalMessageBoxTitle, 
            minWidth: this.minPromptWidth,
            buttons: Ext.Msg.OKCANCEL,
            callback: function(btn, text, cfg ){

                if(btn == 'ok' && Ext.isEmpty(text)) {
                    var newMsg = '<span style="color:red;" class="error">' + Translation.RefusalMessageBoxEmpty + '</span>';
                    Ext.Msg.show(Ext.apply({}, { msg: newMsg }, cfg));
                }else if( btn !== 'ok' ){
                    return;
                }else if( btn == 'ok' ){
                    this.sendRefusalAnswer( methodName, text, "reject", Constant.DocumentStatus.REFUSED, me.selectedDocument.get('id'));
                }

            }, 
            scope:this, 
            multiline: true,  

        });

But still cant figure out how to prevent it from closing on me °_°

Ok I found it... the damn build version was diferent on mz build machine.

I locally have

Build date: 2013-03-11 22:33:40 (aed16176e68b5e8aa1433452b12805c0ad913836)

And on mz test machine we have

Build date: 2013-05-16 14:36:50 (f9be68accb407158ba2b1be2c226a6ce1f649314)

On my local it dous not work... but on the test machin it works without problems... 3 MONTHS! wtf!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM