PDA

View Full Version : How to position a component underneath another one?



mrtndimitrov
23 Sep 2011, 12:53 AM
Hi guys,

Probably this is very simple but I cannot fine in the API the X/Y coordinates of components so I am not sure how to position one component based on the position of another. What I try to achieve is to position a panel underneath of a textbox.

Reagards,

Martin

NickT
24 Sep 2011, 6:39 PM
by acquiring the components element, you can access the position. incidentally, there is also a showBy function on Component that allows you to do this...


{ xtype:'textfield',
label:'text',
listeners:{
'afterrender':function(fld){
var el = fld.getEl();
var panel = new Ext.Panel({
floating:true,
model: true,
height: 200,
width: 200,
html:'hello'
});


panel.show();
panel.setPosition(el.getX(), el.getY()+el.getHeight());
}
}


}

mrtndimitrov
24 Sep 2011, 10:01 PM
Thanks a lot. That was exactly what I needed.