Search code examples
extjsextjs3

ExtJs Message box with Custom buttons


How to display ExtJS Message box with Custom buttons.

I want a Message box with a Custom message and "Cancel" and "Deactivate" Buttons. Please give some idea.

buttons: [{
    text: "Cancel",
    handler: function () {
        Ext.MessageBox.hide();
        //submitTicketForm();
    }
},{
    text: "Deactivate",
    handler: function () {
        Ext.MessageBox.hide();
    }
}],

I am using it like this but not getting any buttons.


Solution

  • MessageBox is an single instance of an internally managed Window used for prompt, show, alert, etc.

    You can change the buttonText by passing in a string for show like this:

    buttons: {ok: "Foo", cancel: "Bar"}
    

    Refer : MessageBox

    buttons: { 
                    ok: "Foo", 
                    handler: function(){ 
                        Ext.MessageBox.hide(); 
    
                    },
                    cancel: "Bar",
                    handler: function(){
                        Ext.MessageBox.hide();
                    }
            }