PDA

View Full Version : Right Align Window



osullivj
22 Nov 2011, 1:43 AM
Hi

I am starting out with extjs and would like to right align a collapsible window I am creating. I can specifically set the x,y but would like to be able to cater for different screen resolutions so that it is down 75 and 200px from the right

Is this possible

Thanks,
J




var myLocationProfile = new Ext.Window({
width : 200,
height : 250,
x : 900,
y : 75,
title : 'Location Profile',
collapsible : true,
floating : true,
renderTo : Ext.getBody(),
html : 'Easy:Yes'
});
myLocationProfile.show();

burnnat
22 Nov 2011, 8:02 AM
Take a look at the alignTo (http://docs.sencha.com/ext-js/4-0/#%21/api/Ext.window.Window-method-alignTo) method. Specifically, you'll want something like:

myLocationProfile.alignTo(Ext.getBody(), 'tr-tr', [-75, 200]);
or maybe just

myLocationProfile.alignTo(Ext.getBody(), 'r-r', [-75, 0]);
depending on what your specific requirements are.

(Also, in ExtJS 4, you should really be using Ext.create (http://docs.sencha.com/ext-js/4-0/#%21/api/Ext-method-create) for instantiation, but that's unrelated.)

osullivj
23 Nov 2011, 8:10 AM
Great..thanks