Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
自定义对话框extjs_Extjs_Extjs4 - Fatal编程技术网

自定义对话框extjs

自定义对话框extjs,extjs,extjs4,Extjs,Extjs4,我尝试为我的应用编写自定义对话框。我想我编写了Ext.window.MessageBox的一个子类,并通过参数传递标题和消息。 我写道: Ext.define('CRUDManantiales.view.dialog.NoUserSelected',{ extend: 'Ext.window.MessageBox', alias: 'dialog.noUserSelected', initComponent: function(){ this.title

我尝试为我的应用编写自定义对话框。我想我编写了Ext.window.MessageBox的一个子类,并通过参数传递标题和消息。 我写道:

Ext.define('CRUDManantiales.view.dialog.NoUserSelected',{
    extend: 'Ext.window.MessageBox',
    alias: 'dialog.noUserSelected',

    initComponent: function(){
        this.title = this.titulo;
        this.msg = 'No se ha seleccionado ningún usuario.\n Asegurese de haber elegido un usuario\n\
                           al cual aplicarle la operación.';
        this.buttons = Ext.MessageBox.OK;
        this.icon = Ext.MessageBox.ERROR;
        this.callParent(arguments)
    }
})
但在创建和显示对话框时:

Ext.create('CRUDManantiales.view.dialog.NoUserSelected',{titulo: 'Agregar administrador'}).show();
萤火虫说:

TypeError:MessageBox.js上未定义cfg
“网络错误:找不到404-”

有什么想法吗?
注意:im使用ExtJs 4.1

您需要将配置对象传递给方法Ext.Msg.,而不是设置组件配置

您可以编写自定义方法,如下所示:

...
initComponent: function(){
    this.callParent(arguments)
},

showError: function() {
    var cfg = {
        title: this.titulo,
        msg: 'No se ha seleccionado ningún usuario.\n Asegurese de haber elegido un usuario\n\al cual aplicarle la operación.',
        buttons: Ext.MessageBox.OK,
        icon: Ext.MessageBox.ERROR
    };
    this.show(cfg);
}
...
和显示对话框:

Ext.create('CRUDManantiales.view.dialog.NoUserSelected',{titulo: 'Agregar administrador'}).showError();