6
Ext.MessageBox.show({
    title:'Messagebox Title',
    msg: 'Are you sure want to delete?',
    buttons: {yes: "Some Button 1",no: "Some Button 2",cancel: "Some Button 3"}
});

ExtJS 4 or 4.1 does not support this code. Buttons do not show.

Meredith
  • 3,928
  • 4
  • 33
  • 58
Ekrem OĞUL
  • 197
  • 3
  • 3
  • 9

4 Answers4

19

Just found out how to do this, hopefully it helps someone. As you can see you can handle the buttons however you want. Note that the framework only has 4 buttons by default and that is a limitation that won't be easily overcome. In the source there are multiple loops hard coded from 0 to < 4.

Ext.MessageBox.show({
    title:'Messagebox Title',
    msg: 'Are you sure want to delete?',
    buttonText: {yes: "Some Button 1",no: "Some Button 2",cancel: "Some Button 3"},
    fn: function(btn){
        console.debug('you clicked: ',btn); //you clicked:  yes
    }
});
user1766719
  • 191
  • 1
  • 4
4

You cannot do that inside the method show, since the buttons config in the method takes as an argument a number identifying the buttons to show. What you can do is to predefine your message box and then just show it.

 var win = Ext.create('Ext.window.MessageBox', {
     width:300,
     height: 100,
     buttons: [
      {text: 'My button 1'},{
        text: 'My button 2'}
    ]
});

win.show({
     title:'Messagebox Title',
     msg: 'Are you sure want to delete?',
    icon: Ext.Msg.QUESTION
});​
nscrob
  • 4,483
  • 1
  • 20
  • 24
3

Use Following Code:

Ext.MessageBox.show({
    title:'Messagebox Title',
    msg: 'Are you sure want to delete?',
    buttonText: {                        
        yes: 'Some Button 1',
        no: 'Some Button 2',
        cancel: 'Some Button 3'
    }
});

Hope it will help you.

Gourav
  • 813
  • 2
  • 10
  • 23
0

Try this solution:

<script type="text/javascript">
            (function () {
                Ext.override(Ext.MessageBox, {
                    buttonText: { yes: "Sí", no: "No", cancel: "Cancelar" }
                });
            })();
    </script>