Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Marc Love (uSkinned.net) 349 posts 946 karma points
    May 11, 2010 @ 11:45
    Marc Love (uSkinned.net)
    0

    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

  • Dirk De Grave 4537 posts 6006 karma points MVP 3x admin c-trib
    May 11, 2010 @ 12:14
    Dirk De Grave
    0

    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

     

  • Marc Love (uSkinned.net) 349 posts 946 karma points
    May 11, 2010 @ 12:20
    Marc Love (uSkinned.net)
    0

    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

  • Dirk De Grave 4537 posts 6006 karma points MVP 3x admin c-trib
    May 11, 2010 @ 12:29
    Dirk De Grave
    1

    Marc,

    should be:

    node.Menu.Clear();

     

    Cheers,

    /Dirk

  • Marc Love (uSkinned.net) 349 posts 946 karma points
    May 11, 2010 @ 12:52
    Marc Love (uSkinned.net)
    0

    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

  • Dirk De Grave 4537 posts 6006 karma points MVP 3x admin c-trib
    May 11, 2010 @ 13:01
    Dirk De Grave
    1

    Marc,

    protected override void CreateRootNode(ref XmlTreeNode rootNode) {
      rootNode.Icon = FolderIcon;
      rootNode.OpenIcon = FolderIconOpen;
      rootNode.NodeType = "x";
      rootNode.NodeID = "-1";
    
      RootNodeActions.Clear();
    }

     

    Cheers,

    /Dirk

  • Marc Love (uSkinned.net) 349 posts 946 karma points
    May 11, 2010 @ 13:57
    Marc Love (uSkinned.net)
    0

    Perfect, Thanks DIrk.

  • Jeff Grine 149 posts 189 karma points
    Aug 02, 2010 @ 20:38
    Jeff Grine
    0

    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

  • Jeff Grine 149 posts 189 karma points
    Aug 02, 2010 @ 20:55
    Jeff Grine
    1

    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).

  • David Conlisk 432 posts 1008 karma points
    Feb 01, 2013 @ 15:20
    David Conlisk
    0

    To clear the menu options for the root node, use Jeff's code:

    rootNode.Menu.Clear();

    This works in v4.11.4.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies