I have created a custom section within Umbraco. I do not need the context menu that appears when you right click on the tree nodes. How do you disable this menu so that it no longer appears?
Either overload the CreateRootNodeActions()/CreateAllowedActions() methods to clear the actions or clear the menu action list in the Render() method (which is fired for each node being rendered in the tree) in your custom class that creates the node structure in the custom section
Cheers Dirk that worked. I have now cleared the Delete option from my custom nodes.
How do you clear the menu from the default root node of the custom section? When I right click on this I get a 'Create' and 'Reload Nodes' option. I would like to remove these options as well.
Any reason RootNodeActions.Clear wouldn't work in 4.5.1? Node.Menu.Clear is working fine, but clearing RootNodeActions seems to have no effect. My code for CreateRootNode is pretty much what is above and I can see the list in the debugger going from 3 items to 0, but the menu is still there on the root node.
Calling rootNode.Menu.Clear in CreateRootNode took care of it. Guess it's nice that it's consistent for all nodes now (assuming something did change here).
Disable Context Menu on Tree in Custom Section
I have created a custom section within Umbraco. I do not need the context menu that appears when you right click on the tree nodes. How do you disable this menu so that it no longer appears?
Cheers,
Marc
Marc,
Either overload the CreateRootNodeActions()/CreateAllowedActions() methods to clear the actions or clear the menu action list in the Render() method (which is fired for each node being rendered in the tree) in your custom class that creates the node structure in the custom section
Hope this helps.
Regards,
/Dirk
Hi Dirk, thanks for the quick reply. I have setup my Render() method to create my custom tree nodes. What is the code to clear the context menu?
Cheers,
Marc
Marc,
should be:
Cheers,
/Dirk
Cheers Dirk that worked. I have now cleared the Delete option from my custom nodes.
How do you clear the menu from the default root node of the custom section? When I right click on this I get a 'Create' and 'Reload Nodes' option. I would like to remove these options as well.
Cheers,
Marc
Marc,
Cheers,
/Dirk
Perfect, Thanks DIrk.
Any reason RootNodeActions.Clear wouldn't work in 4.5.1? Node.Menu.Clear is working fine, but clearing RootNodeActions seems to have no effect. My code for CreateRootNode is pretty much what is above and I can see the list in the debugger going from 3 items to 0, but the menu is still there on the root node.
Thanks,
Jeff
Calling rootNode.Menu.Clear in CreateRootNode took care of it. Guess it's nice that it's consistent for all nodes now (assuming something did change here).
To clear the menu options for the root node, use Jeff's code:
This works in v4.11.4.
is working on a reply...