ExtJS changes the default position of buttons in MessageBox (ExtJS 4.2.1)

If you use code with standard buttons:

Ext.Msg.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
});

the buttons in the window are in order yes - no - cancel. I would like them to be in cancellation order - no - yes for consistency in my application. Is there a way to add another configuration or change it for my needs?

+4
source share
1 answer

Buttons by default are simply created in Ext.window.MessageBox.makeButton () a private method based on Ext.window.MessageBox.buttonIds config and show / hide based on a bitmask buttons: Ext.Msg.YESNOCANCEL.

buttonIds :

    Ext.define('Ext.overrides.MessageBox', {
        override: 'Ext.window.MessageBox',

        OK: 1,           //0001
        CANCEL: 2,       //0010
        NO: 4,           //0100
        YES: 8,          //1000

        OKCANCEL: 3,     //0011
        YESNO: 12,       //1100
        YESNOCANCEL: 14, //1110

        buttonIds: [
            'ok', 'cancel', 'no', 'yes'
        ]
    });

Ext.Msg/Ext.MessageBox Ext.window.MessageBox ( Ext.MessageBox).

, Ext.Msg/Ext.MessageBox, :

    Ext.Msg = Ext.MessageBox = new Ext.window.MessageBox();

.

+7

Source: https://habr.com/ru/post/1672604/


All Articles