PDA

View Full Version : How to find owner panel in initComponent?



ultra2
5 Mar 2012, 5:50 AM
Ext.define('my.TextEdit', {
extend: 'Ext.form.field.Text',
alias: 'widget.MyTextEdit',


initComponent: function () {
this.callParent(arguments);
var ownerPanel = this.up('panel'); //This doesn't work for me.
},
});

or in the constructor?

chramer
5 Mar 2012, 6:10 AM
var ownerPanel = this.owner;

sskow200
5 Mar 2012, 7:45 AM
Don't you mean:



var panel = this.up('form');

ultra2
5 Mar 2012, 10:16 AM
no, these don't work. I think initComponent or constructor is too early point to have a parent reference.
So I need to find other way, but thanks for replies.