Note that there are some explanatory texts on larger screens.

plurals
  1. POMigrating menu from ExtJS 4.0 to 4.1
    primarykey
    data
    text
    <p>I've been migrating my project from ExtJS 4.0 to 4.1. This picture says it all:</p> <p><img src="https://i.stack.imgur.com/erPyn.jpg" alt="enter image description here"></p> <p>This is how I build the menu:</p> <pre><code>function addItems(items) { var toolBarItems = []; for (var i = 0; i &lt; 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; } </code></pre> <p>This didn't happen in 4.0, and I can't seem to find an explanation as to why it's happening now. Any thoughts?</p> <p>UPDATE:</p> <p>@Lolo: Thanks for remind me to update the css files.</p> <p>Unfortunately it didn't solve the problem.</p> <p>I tried to add a renderTo like this:</p> <pre><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', { //TODO: MIGV4 shadow: false, renderTo: Ext.getBody(), items: addChildItems(item.subItems) }); subMenuItems.push(subMenuItem); } return subMenuItems; </code></pre> <p>}</p> <p>And it did solve the sub menu align issue, but some unexpected error still occurs. Once again the picture says it all:</p> <p><img src="https://i.stack.imgur.com/3imNz.jpg" alt="enter image description here"></p> <p>This bug only happens when rendering the menu for the 1st time. When i test again it works just fine.</p> <p>Any thoughts??</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload