Removing submenu item

MikeDMikeD Posts: 81

I have used a variation of Robs "Create Custom Action" ( in order to add a custom action at "&Scripts/VendorName" position of the main menu.

The problem is that there is no remove submenu method in the DzActionMenu Object. I have placed a 'Remove Action from menu' button, if a customer wants to remove it from the menu, but I managed to remove the action but not the "VendorName" submenu. So even if the submenu "VendorName" is empty, it is still under the "&Scripts" menu.


In the following code I collected the menu items into an array and I reverse it (so the last submenu item appears firstly):

//iterate over the items
for (var i=0; i<aMenuItems.length; i+=1){
	//check if the menu item has no items
	if (!aMenuItems[i].hasItems() ){
		//clear it
		delete aMenuItems[i];
		//some menus has items


The 'delete' method didn't work. The aMenuItems[i].deleteLater either. The aMenuItems have no labels or even unique names (all of them appeared as 'ActionMenu').


I could use the




but it will delete every action and submenu even from the main "Script" menu. Then I could rebuild the menu by the actions in the action manager, but I don't think this is the right way.



Thanks a lot for any ideas you may have about it...

Post edited by MikeD on
Sign In or Register to comment.