I have a some class
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: m,
emptyText: 'perapapa'
}
];
AddOrgWindowUI.superclass.initComponent.call(this);
}});
when I create an object var AddOrgWindowForm = new AddOrgWindowUI('aaa'); I want to get arg (‘aaa’) to my new form value (value m). How get it?
Im trying initComponent: function(m) { and thats not working.
The
initComponentfunction is called internally on one of the base classes ofExt.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
thiskeyword to access them.This is possible because for every
Ext.Componentand 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 fromExt.Component, and you are extending fromExt.Windowwhich extends fromExt.Componenttoo.Here you have your example fixed: