-
3 Dec 2012 6:48 AM #1
Answered: Sencha Menu
Answered: Sencha Menu
I've been migrating my project from 4.0 to 4.1.
The picture says it all SenchaMenu.jpg
This is how i build the menu:
This didn't happened in 4.0.Code:function addItems(items) { var toolBarItems = []; for (var i = 0; i < items.length; i++) { var newItem = { text: items[i].Name, command: items[i].Command, height: 24, cls: 'toolbarbtn' }; if (items[i].subItems === undefined || items[i].subItems === []) { newItem.handler = clickToolbarItemHandler; } else { newItem.menu = Ext.create('Ext.menu.Menu', { items: addChildItems(items[i].subItems) }); } toolBarItems.push(Ext.create('Ext.button.Button', newItem)); } return toolBarItems; } function addChildItems(subItems) { var subMenuItems = []; for (var i in subItems) { var item = subItems[i]; var subMenuItem = { text: item.Name, command: item.Command, shadow: false, cls: 'toolbarbtn' }; if (item.subItems === undefined || item.subItems === []) { subMenuItem.handler = clickToolbarItemHandler; } else subMenuItem.menu = Ext.create('Ext.menu.Menu', { items: addChildItems(item.subItems) }); subMenuItems.push(subMenuItem); } return subMenuItems; }
Any thoughts??
Thanks
-
Best Answer Posted by Mteixeira
I've solved it.
From Lolo @StackOverflowI found out that in 4.1 they changed .x-layer class style a bit, which may cause this problem. Try to change position:absolute; to position: absolute !important; in .x-layer. Then you should be good.
-
3 Dec 2012 8:26 AM #2
Well i've solved the align issue by doing this:
But the other bug, where it seems to render two containers, still maintains. The weirdest thing is that it doesn't always happen. The picture bellow shows both situations, when everything is render perfect and when the error occurs:Code:function addChildItems(subItems) { var subMenuItems = []; for (var i in subItems) { var item = subItems[i]; var subMenuItem = { text: item.Name, command: item.Command, cls: 'toolbarbtn' }; if (item.subItems === undefined || item.subItems === []) { subMenuItem.handler = clickToolbarItemHandler; } else subMenuItem.menu = Ext.create('Ext.menu.Menu', { shadow: false, renderTo: Ext.getBody(), items: addChildItems(item.subItems) }); subMenuItems.push(subMenuItem); } return subMenuItems; }
SenchaMenu.jpg
I am missing something? Or is this a bug??
-
4 Dec 2012 8:27 AM #3
I've solved it.
From Lolo @StackOverflowI found out that in 4.1 they changed .x-layer class style a bit, which may cause this problem. Try to change position:absolute; to position: absolute !important; in .x-layer. Then you should be good.


Reply With Quote