View Full Version : removing sub menu items help

16 Apr 2007, 8:38 AM

I have a dynamic menu which has sub menus as well. The sub menu items are added and deleted using the following code:


cannedMessages.items.get(menuId).menu.addMenuItem (new Ext.menu.Item({
text: title,
id: messageId,
cls: 'x-btn-text-icon',
handler: selectCannedMessage}));


var item = cannedMessages.items.get('userCannedMessages').menu.items.get(id);

When the number of items removed is zero, the arrow is still displayed making it confusing to the user as if there are sub items there. Also, when all the items are removed and empty list in IE displays a blank submenu. I have added the following code when removing ite,s and items.length == 0:

if (cannedMessages.items.get('userCannedMessages').menu.items.length == 0)
//alert("is zero");
cannedMessages.items.get('userCannedMessages').menu = null;

This seems to fix it in, but the arrow is still there. This issue is also true for the reverse. When i start with an empty menu, and add a new submenu item, then the arrow designating more items are available does not render.

Am i adding and removing the submenu items incorrectly, or is this a bug?

Any help would be great!