The initComponent
function is called internally on one of the base classes of Ext.Window
. You shouldn't try to call it directly. That is why it won't handle your own parameters.
So I recommend you to use the standard form parameters when extending ExtJS classes.
It is as simple as initializing the object with the property or methods you want to override (or insert in case the property is not in there already). And then just using the this
keyword to access them.
This is possible because for every Ext.Component
and its subclasses, the first parameter passed to the constructor should be an object, and every member in that object will be copied to the new object constructed. And most ExtJS classes extend directly or indirectly from Ext.Component
, and you are extending from Ext.Window
which extends from Ext.Component
too.
Here you have your example fixed:
var AddOrgWindowUI = Ext.extend(Ext.Window, {
title: 'form',
width: 400,
height: 198,
layout: 'form',
padding: 5,
initComponent: function() {
this.items = [
{
xtype: 'textfield',
fieldLabel: 'parapapa',
anchor: '95%',
value: this.initialValue,
emptyText: 'perapapa'
}
];
AddOrgWindowUI.superclass.initComponent.call(this);
}
});
function test() {
var AddOrgWindowForm = new AddOrgWindowUI({initialValue:'aaa'});
AddOrgWindowForm.show();
}