View Full Version : no destroy method on MenuItem

9 Apr 2007, 5:53 PM
the following code breaks....

filterMenu = new Ext.menu.Menu({id:"filterMenu"});
filterMenu.add({id:"cancelFilter1", text: "Cancel Filter1", cls: "xg-hmenu-sort-desc"});
filterMenu.remove({id:"cancelFilter1", text: "Cancel Filter1", cls: "xg-hmenu-sort-desc"});

Firebug error details:

item.destroy is not a function
remove(Object id=cancelFilter1 text=Cancel Filter1)ext-all-debug.js (line 17960)
CustomEvent(contextmenu )yui-utilities.js (line 13)
[Break on this error] item.destroy();

9 Apr 2007, 6:52 PM
Destroy is defined on a menuItem - it's in the parent object (Component). You are calling remove with an invalid argument. You need to pass an item, not a config object.