PDA

View Full Version : Dynamic menu layout problem



ajruli.semir
4 Jul 2014, 1:12 AM
Hi all,

I have menu with dynamic items in bottom bar. There is a problem when I have more than 3 items in the menu. It does'n show the rest items.

49557


One of my ideas is to rewrite function for calculating height



// @private
// adjust the vertical position of the menu if the height of the
// menu is equal (or greater than) the viewport size
setVerticalPosition: function(){
var me = this,
max,
y = me.el.getY(),
returnY = y,
height = me.getHeight(),
viewportHeight = Ext.Element.getViewportHeight().height,
parentEl = Ext.fly(me.el.getScopeParent()),
viewHeight = parentEl.getViewSize().height,
normalY = y - parentEl.getScroll().top; // factor in scrollTop of parent

parentEl = null;

if (me.floating) {
max = me.maxHeight ? me.maxHeight : viewHeight - normalY;
if (height > viewHeight) {
returnY = y - normalY;
} else if (max < height) {
returnY = y - (height - max);
} else if((y + height) > viewportHeight){ // keep the document from scrolling
returnY = viewportHeight - height;
}
}
me.el.setY(returnY);
}


Is this a good way to solve the problem?

Gary Schlosberg
13 Jul 2014, 4:01 PM
I guess it doesn't happen for you unless the menu items are added dynamically? Seems to work statically in this Fiddle:
https://fiddle.sencha.com/#fiddle/7ll

What does the menu look like when you inspect it? Is the 4th (non-visible) item there?