PDA

View Full Version : Ext.menu.Menu - autoAlign?!



casbar
5 Aug 2009, 3:56 AM
Hello,
i tried to change the defaultAlign to a menu but it don't works how u can see in the attachment...
is it possible to set an "autoAlign" or something similar.

I hadn't get this problem with ext2.2 ...

thanks!!
casbar

Animal
5 Aug 2009, 3:59 AM
What attachment?

Do not use forum attachments for screenshots anyway, it's useless. Use photobucket.com

And show code.

casbar
5 Aug 2009, 4:51 AM
Screenshot: http://img87.imageshack.us/img87/8939/menuvdi.jpg

Code:




var ContextMenu = new Ext.menu.Menu({renderTo: Ext.getBody(), enableScrolling:false});

[...]

ContextMenu.defaultAlign = 'bl-tl?';

ContextMenu.showAt(coor);


Any idea?

Animal
5 Aug 2009, 5:36 AM
defaultAlign is meaningless when you use showAt, it shows at there.

casbar
5 Aug 2009, 6:00 AM
but then how i can show the menu with a different align at the mouse position? There isn't any other way right?

Animal
5 Aug 2009, 6:01 AM
It's up to you!

YOU are telling it where to appear!

Animal
5 Aug 2009, 6:11 AM
You could try using your programming and investigation skills to write a nice method to constrain any BoxComponent, and then call it on your Menu after showing.



Ext.override(Ext.BoxComponent, {
doConstrain: function() {
if (this.rendered) {
this.container = this.el.dom.parentNode;
this.constrain = true;
Ext.Window.prototype.doConstrain.call(this);
}
}
});