View Full Version : Positioning a Child in Container to top right

16 Apr 2014, 10:46 AM

I extend Container, which contains only 1 component - namely an Image Component.

The Image's top right corner needs to be anchored to the container's top right corner.

How can I position the image in this way WITHOUT using a hbox pack and BEFORE it's rendered? (My reason for this is because the image moves within the container and the new position needs to remain after resizing)


16 Apr 2014, 1:29 PM
Something like this?

name : 'Fiddle',

launch : function() {

var panel = Ext.create('Ext.panel.Panel', {
title: 'Hello',
width: 200,
height: 200

var win = Ext.create('Ext.window.Window', {
title: 'Hello',
height: 600,
width: 600,
items: [ panel ]

win.on('resize', function(win) {
var pnl = win.down('panel');
pnl.setLocalX(win.width - pnl.width);

16 Apr 2014, 1:31 PM
I used the following in afterRender():

img.el.alignTo(this.el, "tr-tr");

Does the trick nicely