X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/6e39d509471fe9b4e2660e0d1631b350d0c66f40..92c2b89db26be16707f4a805d3303ab2531006e1:/docs/source/Menu.html diff --git a/docs/source/Menu.html b/docs/source/Menu.html index 4de5529e..86f79e16 100644 --- a/docs/source/Menu.html +++ b/docs/source/Menu.html @@ -6,99 +6,7 @@
-/** - * @class Ext.layout.MenuLayout - * @extends Ext.layout.ContainerLayout - *Layout manager used by {@link Ext.menu.Menu}. Generally this class should not need to be used directly.
- */ - Ext.layout.MenuLayout = Ext.extend(Ext.layout.ContainerLayout, { - monitorResize : true, - - setContainer : function(ct){ - this.monitorResize = !ct.floating; - // This event is only fired by the menu in IE, used so we don't couple - // the menu with the layout. - ct.on('autosize', this.doAutoSize, this); - Ext.layout.MenuLayout.superclass.setContainer.call(this, ct); - }, - - renderItem : function(c, position, target){ - if (!this.itemTpl) { - this.itemTpl = Ext.layout.MenuLayout.prototype.itemTpl = new Ext.XTemplate( - '
/** * @class Ext.menu.Menu * @extends Ext.Container *A menu object. This is the container to which you may add menu items. Menu can also serve as a base class @@ -194,6 +102,13 @@ Ext.menu.Menu = Ext.extend(Ext.Container, { */ floating : true, + +
/** + * @cfg {Number} zIndex + * zIndex to use when the menu is floating. + */ + zIndex: 15000, + // private hidden : true, @@ -258,10 +173,10 @@ Ext.menu.Menu = Ext.extend(Ext.Container, { } Ext.menu.Menu.superclass.initComponent.call(this); if(this.autoLayout){ + var fn = this.doLayout.createDelegate(this, []); this.on({ - add: this.doLayout, - remove: this.doLayout, - scope: this + add: fn, + remove: fn }); } }, @@ -292,7 +207,7 @@ Ext.menu.Menu = Ext.extend(Ext.Container, { dh: dh, constrain: false, parentEl: ct, - zindex:15000 + zindex: this.zIndex }); }else{ this.el = ct.createChild(dh); @@ -476,7 +391,7 @@ Ext.menu.Menu = Ext.extend(Ext.Container, { // set the position so we can figure out the constrain value. this.el.setXY(xy); //constrain the value, keep the y coordinate the same - this.constrainScroll(xy[1]); + xy[1] = this.constrainScroll(xy[1]); xy = [this.el.adjustForConstraints(xy)[0], xy[1]]; }else{ //constrain to the viewport. @@ -499,9 +414,24 @@ Ext.menu.Menu = Ext.extend(Ext.Container, { }, constrainScroll : function(y){ - var max, full = this.ul.setHeight('auto').getHeight(); + var max, full = this.ul.setHeight('auto').getHeight(), + returnY = y, normalY, parentEl, scrollTop, viewHeight; if(this.floating){ - max = this.maxHeight ? this.maxHeight : Ext.fly(this.el.dom.parentNode).getViewSize(false).height - y; + parentEl = Ext.fly(this.el.dom.parentNode); + scrollTop = parentEl.getScroll().top; + viewHeight = parentEl.getViewSize().height; + //Normalize y by the scroll position for the parent element. Need to move it into the coordinate space + //of the view. + normalY = y - scrollTop; + max = this.maxHeight ? this.maxHeight : viewHeight - normalY; + if(full > viewHeight) { + max = viewHeight; + //Set returnY equal to (0,0) in view space by reducing y by the value of normalY + returnY = y - normalY; + } else if(max < full) { + returnY = y - (full - max); + max = full; + } }else{ max = this.getHeight(); } @@ -515,6 +445,7 @@ Ext.menu.Menu = Ext.extend(Ext.Container, { this.el.select('.x-menu-scroller').setDisplayed('none'); } this.ul.dom.scrollTop = 0; + return returnY; }, createScrollers : function(){ @@ -575,9 +506,11 @@ Ext.menu.Menu = Ext.extend(Ext.Container, { * @param {Boolean} deep (optional) True to hide all parent menus recursively, if any (defaults to false) */ hide : function(deep){ - this.deepHide = deep; - Ext.menu.Menu.superclass.hide.call(this); - delete this.deepHide; + if (!this.isDestroyed) { + this.deepHide = deep; + Ext.menu.Menu.superclass.hide.call(this); + delete this.deepHide; + } }, // private @@ -655,7 +588,9 @@ Ext.menu.Menu = Ext.extend(Ext.Container, { * @return {Ext.menu.Item} The menu item that was added */ addElement : function(el){ - return this.add(new Ext.menu.BaseItem(el)); + return this.add(new Ext.menu.BaseItem({ + el: el + })); }, /** @@ -687,6 +622,7 @@ Ext.menu.Menu = Ext.extend(Ext.Container, { //private onDestroy : function(){ + Ext.EventManager.removeResizeListener(this.hide, this); var pm = this.parentMenu; if(pm && pm.activeChild == this){ delete pm.activeChild; @@ -694,7 +630,6 @@ Ext.menu.Menu = Ext.extend(Ext.Container, { delete this.parentMenu; Ext.menu.Menu.superclass.onDestroy.call(this); Ext.menu.MenuMgr.unregister(this); - Ext.EventManager.removeResizeListener(this.hide, this); if(this.keyNav) { this.keyNav.disable(); }