Reputation: 197
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.
Upvotes: 6
Views: 15132
Reputation: 813
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.
Upvotes: 3
Reputation: 11
Try this solution:
<script type="text/javascript">
(function () {
Ext.override(Ext.MessageBox, {
buttonText: { yes: "Sí", no: "No", cancel: "Cancelar" }
});
})();
</script>
Upvotes: 0
Reputation: 191
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
}
});
Upvotes: 19
Reputation: 4483
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
});
Upvotes: 4