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.
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
}
});
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
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With