I need to add a newly-created MenuItem at runtime; so my code currently looks like:
var myMenu = myCmp.query('mymenu')[0]; // retrieve my only Menu object
var menuItem = Ext.create('Ext.menu.Item', {
itemId: 'myItemId', text: 'textGoesHere'
});
myMenu.add(menuItem);
I'm using the add
method to add the item; but nothing happens to the menu items though at run-time. Even though debugging shows that the new item has actually been added to the items
config of the Menu instance.
Using the remove
method however does work, at run-time.
Question: How to make the newly added MenuItem show at runtime? What am I missing?
UPDATE: the above code works; I had a flawed switch statement that was causing another pass through the logic, removing the last created menuItem.