Results 1 to 7 of 7

Thread: Ext.MessageBox customize buttons name

  1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    6

    Default Answered: Ext.MessageBox customize buttons name

    Hi,
    I can't change default ok and cancel buttons name in MesasgeBox, my code :
    Code:
    Ext.MessageBox.show({
         title:'Change confirm',
         msg: 'Please confirm changes?',
         buttons: Ext.Msg.OKCANCEL,
         buttonText: {ok: 'confirm', cancel: 'don't confirm'},
         icon: Ext.MessageBox.QUESTION
    });
    when this code is running the name of buttons are the same as default('Ok', 'Cancel') not that what i defined in buttonText properties, i try all founded methods in sencha forum but no one help me to rename buttons.
    It is a proper way in ext js 4.0.7 to change default buttons name in message box?
    Thanks in advance.

  2. Last time I checked the locale files didn't work for message boxes. Try this:

    http://www.sencha.com/forum/showthread.php?154185

  3. #2
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,751
    Answers
    130

    Default

    take a look at the locale folder containing the localization files. there you have:

    Code:
          Ext.MessageBox.buttonText = {
            ok     : "OK",
            cancel : "Cancel",
            yes    : "Yes",
            no     : "No"
          };
    you can change that (or override it later) to fullfil your needs.
    Best regards
    Tobias Uhlig

  4. #3
    Sencha User
    Join Date
    Oct 2011
    Posts
    6

    Default

    I append to my code this lines
    Code:
    <link rel="stylesheet" type="text/css" href="/extjs/resources/css/ext-all-gray.css">
     <script type="text/javascript" src="/extjs/ext-all.js"></script>
     <script type="text/javascript" src="/extjs/locale/ext-lang-ro.js"></script>
    now i must have Romanian locale for ExtJs , and if i want that MessageBox to show ok and the cancel button, buttons must have names form locale/ext-lang-ro.js
    Code:
    Ext.MessageBox.buttonText = {
              ok     : "OK",
              cancel : "Renun??",
              yes    : "Da",
              no     : "Nu"
           };
    but with this code :
    Code:
    Ext.MessageBox.show({
         title:'Change confirm',
         msg: 'Please confirm changes?',
         buttons: Ext.Msg.OKCANCEL,
         icon: Ext.MessageBox.QUESTION
    });
    the text of buttons is 'Ok' and 'Cancel', but must be 'OK' and ' Renun??'. Can i solve this?

  5. #4
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,791
    Answers
    585

    Default

    Last time I checked the locale files didn't work for message boxes. Try this:

    http://www.sencha.com/forum/showthread.php?154185

  6. #5
    Sencha User
    Join Date
    Oct 2011
    Posts
    6

    Default

    trying this code:
    Code:
    var ok = Ext.MessageBox.down('#ok');
    ok.setText('confirm');
    var cancel = Ext.MessageBox.down('#cancel');
    cancel.setText('don't confirm');
    Ext.MessageBox.show({
         title:'Change confirm',
         msg: 'Please confirm changes?',
         buttons: Ext.Msg.OKCANCEL,
         icon: Ext.MessageBox.QUESTION
     });
    yes, it is override default buttons name.
    Thanks for quick answers.

  7. #6
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379
    Answers
    3997

    Default

    I should get the answer on this thread
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  8. #7
    Sencha User
    Join Date
    Jul 2012
    Posts
    3

    Default

    Quote Originally Posted by mitchellsimoens View Post
    I should get the answer on this thread
    What's the point of putting in documentation when it clearly doesn't work? It's set in Ext.MessageBox; buttonText in the 4.07 documentation but yet it doesn't work at all.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •