PDA

View Full Version : Ext.MessageBox.YESNOCANCEL change text buttons



ssamuel68
10 Jul 2012, 1:31 PM
Hi, Im trying to change the text of the buttons of my YESNOCANCEL MessageBox.

I tried this:
Ext.MessageBox.msgButtons['yes'].text ='Save';
But it overrides all my other messages windows buttons,

I also tried to change the buttons config like this:
buttons: [{text:'Save'}],

Also tried add this config:
buttonText: {ok: "OK", yes: "Save", no: "Dont Save", cancel: "Cancel"}

And this:
buttons : {yes : 'Save', no : 'Dont Save', cancel : 'Cancel'},

Can anyone help me;

Thx
Sam

jay@moduscreate.com
10 Jul 2012, 1:42 PM
It works for me:


Ext.MessageBox.show({
title: 'What, really?',
msg: 'Are you sure?',
buttons: Ext.MessageBox.YESNO,
buttonText:{
yes: "Definitely!",
no: "No chance!"
},
fn: showResult
});

ssamuel68
10 Jul 2012, 1:50 PM
It doesnt for me. Let me show my code:


Ext.MessageBox.show({
title:'Save Changes?',
msg: 'You are closing a tab that has unsaved changes. Would you like to save your changes?',
buttons: Ext.Msg.YESNOCANCEL,
icon: Ext.Msg.QUESTION
fn: function(btn){
if (btn == "no"){
//NO
}
if (btn == "yes"){
//YES
}
}
});


Im using Extjs4.

I also tried your code on the page editor:
http://docs.sencha.com/ext-js/4-0/#!/api/Ext.window.MessageBox-property-YESNOCANCEL

ssamuel68
10 Jul 2012, 1:53 PM
I tried on the sencha editor that is on the page of the example and dont work for me

http://docs.sencha.com/ext-js/4-0/#!/api/Ext.window.MessageBox-property-YESNOCANCEL

scottmartin
10 Jul 2012, 2:02 PM
Try upgrading to 4.1 ... does not work in 4.0

Scott.

scottmartin
10 Jul 2012, 2:04 PM
Tested OK in 4.07



Ext.onReady(function() {
var messageBox = Ext.create('Ext.window.MessageBox', {
buttonText: {
yes: 'Definitely',
no: 'No chance'
}
});
messageBox.show({
title: "A Title",
msg: 'A Message',
buttons: Ext.Msg.YESNO,
icon: Ext.MessageBox.WARNING
});

});?


Scott.

ssamuel68
11 Jul 2012, 8:21 AM
Thanks, it works great :D