-
27 Dec 2010 3:14 AM #1
[resolved] Ext Msg Confirm change button text
[resolved] Ext Msg Confirm change button text
Hi,
How i can change the button text ? (yes and no)
thanks in advance.Code:handler: function(){ Ext.Msg.confirm("Etes vous sûr", "", function(e){if(e == 'yes'){ Ext.getCmp('main').setActiveItem(6); } }); }Last edited by dmassiani; 29 Dec 2010 at 8:21 AM. Reason: resolved
-
29 Dec 2010 4:17 AM #2
Hi dmassiani,
I don't know if it's the proper way, but this is how I've finally done it:
I just changed the 'Yes' button, as 'No' is the same in Spanish, but you could also change it. Have a look at lines 39875 - 39894 in sencha-touch-debug-w-comments.js (1.0.1) and you'll see the properties you have to override to change the default texts.Code:if(Ext.MessageBox) { var MB = Ext.MessageBox; Ext.apply(MB, { YES: { text: 'Sí', itemId: 'yes', ui: 'action' } }); Ext.apply(MB, { YESNO: [Ext.MessageBox.NO, Ext.MessageBox.YES] }); }
-
29 Dec 2010 8:20 AM #3
yes that's done
i have do that :
thank youCode:var MB = Ext.MessageBox; Ext.apply(MB, { YES: { text: 'Oui', itemId: 'yes', ui: 'action' } }); Ext.apply(MB, { NO: { text: 'Non', itemId: 'no' } }); Ext.apply(MB, { YESNO: [Ext.MessageBox.NO, Ext.MessageBox.YES] });
-
29 Dec 2010 9:19 AM #4
If you want to make it shorter,
Should also work. Only YESNO has to be applied after YES and NO have been assigned, as it references them and if you did it in the same "apply" method their values would still be the old ones.Code:var MB = Ext.MessageBox; Ext.apply(MB, { YES: { text: 'Oui', itemId: 'yes', ui: 'action' }, NO: { text: 'Non', itemId: 'no' } }); Ext.apply(MB, { YESNO: [MB.NO, MB.YES] });
Ext.MessageBox could also be shortened to MB in the second Ext.apply (I made the mistake when writing the example code).
-
29 Dec 2010 11:32 PM #5
thanks you very much.
i appreciate your answer
-
20 Dec 2012 2:04 PM #6
I found this solution which I find to be more preferable: http://www.epiphanydigital.biz/2011/...ustom-buttons/
PHP Code:Ext.Msg.show({
title : 'Enter Email Address',
msg : null,
buttons : [{
itemId : 'ok',
text : 'Send',
ui : 'action'
},{
itemId : 'cancel',
text : 'Cancel'
}],
prompt : {
maxlength : 180,
autocapitalize : false },
fn : function(text,btn) { // do some stuff }
});
-
11 Mar 2013 11:45 AM #7
I have another way
I have another way
Ext.MessageBox.prompt() is using Ext.MessageBox object properties, like buttonText.
If you do something like this :
var promptBox = Ext.Msg;
promptBox.buttonText={
cancel: 'cancelText',
no: 'noText',
ok: 'okText',
yes: 'yesText'
};
If you call :
promptBox.prompt(title, message, callback)
OK and CANCEL buttons are displayed with their text label.
Tested in ExtJs 3.2
Similar Threads
-
[CLOSED] Ext.Msg.confirm - YES/NO Order
By phroggar in forum Sencha Touch 1.x: BugsReplies: 0Last Post: 9 Nov 2010, 5:34 AM -
Ext.Msg.confirm not passing which button pressed
By mikeyroy in forum Sencha Touch 1.x: DiscussionReplies: 4Last Post: 26 Oct 2010, 11:00 PM -
Desktop from example and Ext.Msg.confirm
By evgenspb in forum Ext 3.x: Help & DiscussionReplies: 1Last Post: 13 Aug 2010, 12:02 AM -
waiting for asynchronous Ext.msg.Confirm
By randomuser01 in forum Ext 2.x: Help & DiscussionReplies: 0Last Post: 2 Oct 2008, 11:32 AM -
[2.0.1/2.1] Bug in Ext.Msg.show attribute - buttonText - change button label
By thiagoaos in forum Ext 2.x: BugsReplies: 0Last Post: 16 May 2008, 9:18 AM


Reply With Quote