1. #1
    Sencha User
    Join Date
    Feb 2008
    Posts
    116
    Vote Rating
    0
    buntyindia is on a distinguished road

      0  

    Default custom button for Messagebox Show

    Hi ,


    Can we have custom button for Messagebox Show
    I need to button with name

    OK and Logoff. If Yes, How?

    Thanks

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    105
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default

    You can't create more buttons than the 4 default buttons, but you can rename them:
    Code:
    Ext.Msg.buttonText.cancel = 'Logoff';

  3. #3
    Sencha User
    Join Date
    Feb 2008
    Posts
    116
    Vote Rating
    0
    buntyindia is on a distinguished road

      0  

    Default

    Quote Originally Posted by Condor View Post
    You can't create more buttons than the 4 default buttons, but you can rename them:
    Code:
    Ext.Msg.buttonText.cancel = 'Logoff';
    where I have to right this line? I need to rename both YES, NO button to OK and LogOff

    my code is:



    Code:
    Ext.MessageBox.show({
                                   title:'Session Time Out Warning!',
                                   msg: 'Session about to expire',
                                   buttons: Ext.MessageBox.YESNO,
                                   fn: function(btn, text){
                                                if (btn == 'yes'){
                                                    Ext.Ajax.request({
                                                       url: 'some.htm'
                                                    });
                                                
                                                }
                                                if (btn == 'no'){
                                                   
                                                }
                                            },
                                   icon: Ext.MessageBox.WARNING,
                                   closable : false
                               });

  4. #4
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    105
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default

    Before showing the dialog (and don't forget to restore the button text after you're done with this dialog).

    Why are you using the Yes and No buttons if there already is an OK button? I would use the OK and Cancel buttons and rename Cancel to Logoff (as my example did).

  5. #5
    Sencha User dawesi's Avatar
    Join Date
    Mar 2007
    Location
    Melbourne, Australia (aka GMT+10)
    Posts
    1,091
    Vote Rating
    57
    dawesi has a spectacular aura about dawesi has a spectacular aura about

      0  

    Default

    you could create an extension (apparently :-)) that allows you to extent(d) extent... hehe
    Lead Trainer / Sencha Specialist
    Community And Learning Systems

    Lead Architect
    DigitalTickets.net

  6. #6
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    105
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default

    Ext.MessageBox is a singleton with a lot of private variables, so it's almost impossible to extend.

  7. #7
    Sencha User
    Join Date
    Feb 2008
    Posts
    116
    Vote Rating
    0
    buntyindia is on a distinguished road

      0  

    Default

    Thanks to you

    I used

    Code:
     buttons: {ok:'Ok', cancel:'LogOff'}
    it works gr8 doing the same purpose

  8. #8
    Sencha User
    Join Date
    May 2011
    Location
    Argentina
    Posts
    55
    Vote Rating
    3
    ferengidedalo is on a distinguished road

      0  

    Default

    this NOT work on V4.... any other method?

  9. #9
    Ext JS Premium Member andreasn's Avatar
    Join Date
    Jan 2008
    Location
    Zuzwil, Switzerland
    Posts
    12
    Vote Rating
    0
    andreasn is on a distinguished road

      0  

    Default

    Quote Originally Posted by ferengidedalo View Post
    this NOT work on V4.... any other method?
    Try this:

    Code:
            Ext.Msg.show({
                title: 'Benutzer löschen',
                msg: 'Möchten Sie den Benutzer wirklich löschen? Sie können ihn auch deaktivieren.',
                buttonText: {
                    yes: 'Deaktivieren', no: 'Löschen', cancel: 'Abbrechen'
                },
                buttons: Ext.Msg.YESNOCANCEL
            });
    It changes the buttonText only for this message.