Copied to clipboard

Flag this post as spam?

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


  • Brad 69 posts 97 karma points
    Jun 25, 2019 @ 18:42
    Brad
    0

    How to add custom tree to existing section.

    I'd like to add a folder under Members that when you click it shows a view that has whatever on it. I can create the folder no problem, and disable the "children" feature with root.HasChildren, but nothing I do lets me click the folder to show a view. I've tried using root.RoutePath but it either does nothing or gives an error, or redirects back to /content. Any ideas?

    [Tree("member", "memberMessages", "Messages", "icon-folder", "icon-folder", true, 3)]
    [PluginController("MemberMessages")]
    public class MemberMessagesController : TreeController
    {
        protected override MenuItemCollection GetMenuForNode(string id, [ModelBinder(typeof(HttpQueryStringModelBinder))] FormDataCollection queryStrings)
        {
            //throw new NotImplementedException();
            return new MenuItemCollection();
    
            //
        }
    
        protected override TreeNode CreateRootNode(FormDataCollection queryStrings)
        {
            var root = base.CreateRootNode(queryStrings);
    
            //root.RoutePath = "memberMessages/";
            root.Icon = "icon-folder";
    
            root.HasChildren = false;
            return root;
        }
    
        protected override TreeNodeCollection GetTreeNodes(string id, [ModelBinder(typeof(HttpQueryStringModelBinder))] FormDataCollection queryStrings)
        {
            return new TreeNodeCollection();
        }
    }
    
  • Brad 69 posts 97 karma points
    Jun 25, 2019 @ 18:50
    Brad
    0

    In case anyone ever has this question here is my code:

    protected override TreeNode CreateRootNode(FormDataCollection queryStrings)
        {
            var root = base.CreateRootNode(queryStrings);
    
            root.RoutePath = "member/memberMessages/overview";
    
            root.Icon = "icon-message";
    
            root.HasChildren = false;
            return root;
        }
    

    And I created this file: app_plugins/MemberMessages/backoffice/memberMessages/overview.html

Please Sign in or register to post replies

Write your reply to:

Draft