我正在定义一个扩展Ext.form.Panel的类,但是当它显示时它们都没有出现(它们甚至不在DOM中)。以这种方式定义类有什么问题吗?
Ext.define('myapp.view.admin.EditUserFormPanel', {
extend: 'Ext.form.Panel',
requires: [
'myapp.util.Logger'
],
/**
* Constructor, typically used to create any instance variables and declare
* the events that this object may fire (if it is Observable). For more info
* see http://goo.gl/rXpzO
*
* @param {Object} config (optional)
*/
constructor: function(config) {
var me = this; // http://goo.gl/QYYZm
config = config || {};
Log.info('Created '+me.self.getName());
// Call the method we are overriding (i.e., the parent's constructor),
// passing in all arguments that we have received via JavaScript's
// standard "arguments" object.
me.callParent(arguments);
// Apply default config settings
me.initConfig(config);
me.items = [
{
type: 'textfield',
fieldLabel: 'OpenID',
name: 'openid'
},
{
type: 'textfield',
fieldLabel: 'First',
name: 'firstName'
},
{
type: 'textfield',
fieldLabel: 'Last',
name: 'lastName'
},
{
type: 'textfield',
fieldLabel: 'Email',
name: 'email'
}
];
return me;
}
});
感谢您提供任何帮助/建议。
答案 0 :(得分:1)
我认为您需要使用xtype: 'textfield'
而不是type: textfield
答案 1 :(得分:1)
对于视图(可见组件)(更详细:从Ext.Component继承的所有内容),您应该使用initComponent
而不是constructor
来设置组件。
只需在示例中将constructor
替换为initComponent
,它就应该有效。