Extjs4 ExtJS 4或4.1 MessageBox自定义按钮

Extjs4 ExtJS 4或4.1 MessageBox自定义按钮,extjs4,extjs4.1,Extjs4,Extjs4.1,ExtJS 4或4.1不支持此代码。按钮不显示。您不能在方法show中执行此操作,因为方法中的按钮配置将标识要显示的按钮的数字作为参数。 你可以做的是预先定义你的消息框,然后显示它 Ext.MessageBox.show({ title:'Messagebox Title', msg: 'Are you sure want to delete?', buttons: {yes: "Some Button 1",no: "Some Button 2",cancel: "So

ExtJS 4或4.1不支持此代码。按钮不显示。

您不能在方法show中执行此操作,因为方法中的按钮配置将标识要显示的按钮的数字作为参数。 你可以做的是预先定义你的消息框,然后显示它

Ext.MessageBox.show({
    title:'Messagebox Title',
    msg: 'Are you sure want to delete?',
    buttons: {yes: "Some Button 1",no: "Some Button 2",cancel: "Some Button 3"}
});

刚刚发现了如何做到这一点,希望它能帮助一些人。正如你所看到的,你可以随心所欲地操作按钮。请注意,默认情况下框架只有4个按钮,这是一个不容易克服的限制。在源中有多个硬编码为0到<4的循环

 var win = Ext.create('Ext.window.MessageBox', {
     width:300,
     height: 100,
     buttons: [
      {text: 'My button 1'},{
        text: 'My button 2'}
    ]
});

win.show({
     title:'Messagebox Title',
     msg: 'Are you sure want to delete?',
    icon: Ext.Msg.QUESTION
});​

尝试以下解决方案:

Ext.MessageBox.show({
    title:'Messagebox Title',
    msg: 'Are you sure want to delete?',
    buttonText: {yes: "Some Button 1",no: "Some Button 2",cancel: "Some Button 3"},
    fn: function(btn){
        console.debug('you clicked: ',btn); //you clicked:  yes
    }
});

(功能(){
Ext.override(Ext.MessageBox{
按钮文本:{是:“Sí”,否:“否”,取消:“取消”}
});
})();
使用以下代码:

<script type="text/javascript">
            (function () {
                Ext.override(Ext.MessageBox, {
                    buttonText: { yes: "Sí", no: "No", cancel: "Cancelar" }
                });
            })();
    </script>
希望它能帮助你

Ext.MessageBox.show({
    title:'Messagebox Title',
    msg: 'Are you sure want to delete?',
    buttonText: {                        
        yes: 'Some Button 1',
        no: 'Some Button 2',
        cancel: 'Some Button 3'
    }
});