PDA

View Full Version : [DUP] xtype is set to 'element' for different elements, instead of the proper xtype.



stefankendall
17 Nov 2012, 5:37 PM
I have a nested element. When I try to use the "up" method in the painted listener, I get null when querying for formpanel. When I use getParent() to climb the component chain, the formpanel (identified by its auto-generated id) has an xtype value of "element". I'm guessing this is why up is failing.

This was working in 2.0.0.


Ext.application({
launch:function () {
Ext.create('Ext.form.Panel', {
fullscreen:true,
items:[
{
xtype:'fieldset',
cls:'notes-form',
items:[
{
xtype:'textareafield',
name:'notes',
listeners:{
painted:function (c) {
var parentHeight = c.up('formpanel').element.getHeight(true);
c.element.down('textarea').setHeight(parentHeight - 7);
}
}
}
]
}
]
});
}
});

suzuki1100nz
17 Nov 2012, 7:18 PM
Hi,

Think your getting mixed up between component query and dom query.
Your code is using a dom query (c is an Ext.Element) returning an Ext.dom.Element so is expecting css selectors see- http://docs.sencha.com/touch/2-1/#!/api/Ext.DomQuery
(http://docs.sencha.com/touch/2-1/#!/api/Ext.DomQuery)

To use a component query try

this.up('formpanel')......

You could also set itemId on the panel and use that to find the panel, that way if you change the type it wont break your query code

mitchellsimoens
19 Nov 2012, 11:04 AM
There is currently a bug where the painted event, the first argument is the element not the component as it should be.