自定义对话框extjs
我尝试为我的应用编写自定义对话框。我想我编写了Ext.window.MessageBox的一个子类,并通过参数传递标题和消息。 我写道:自定义对话框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.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();