javascript - How to keep Sencha Ext.Msg from closing on button click -
so have message box built able send message. has 2 inputs, , ok , cancel buttons. can access contents , normal logic quite how set up:
ext.msg.show({ title: 'send message: ', cls: 'messagebox', html: '<div class="message-innercontainer" >' + '<input type="text" id="messageboxsubject" placeholder="subject" class="messagebox-input"/>' + '<textarea id="messageboxmessage" placeholder="message" class="messagebox-textarea"></textarea>' + '<div>', closable: false, buttons: [ { no: 'cancel', text:'cancel', cls:'messagebox-cancelbutton'}, { yes: 'ok', text:'ok', cls:'messagebox-okbutton'} ], fn: function (btn) { if (btn == 'ok') { //do success logic } else (){ //do failure logic } } });
there 1 problem: can't seem find way keep box auto closing when ok pressed. ideally run quick check ensure 2 inputs not empty. think might able override buttons placing custom buttons in html section, if there way halt auto closing more syntactically pleasing , readable. know if possible?
oh my! should consider using regular ext text field , text area items of window instead of own baked html...
anyway, use handler
of buttons, instead of fn
handler. you'll able whatever want in there, , close window if feel it:
buttons: [ { text:'cancel', cls:'messagebox-cancelbutton', handler: function() { this.hide(); }}, { text:'ok', cls:'messagebox-okbutton', handler: function() { var allgood = false; // stuff here // ... , if satisfied result, close window if (allgood) { this.hide(); } }} ]
Comments
Post a Comment