Copied to clipboard

Flag this post as spam?

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


  • Nemes1sX 6 posts 26 karma points
    Sep 24, 2021 @ 18:57
    Nemes1sX
    0

    Doesn't render level 2 child nodes

    Hello I have issue with Umbraco back office. It doesn't render level 2 child nodes in the custom section tree. I have no issue to make issue to make level 1 child node as root node for level 2 child nodes.

      [Tree("Test", "TestTree", TreeTitle = "Dashboard", TreeGroup = "Test", SortOrder = 1)]
        [PluginController("Test")]
     protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
    
        {
            if (id == Constants.System.Root.ToInvariantString())
            {
                Dictionary<int, string> amberMenu = new Dictionary<int, string>();
    
                testMenu.Add(1, "Test");
    
                var nodes = new TreeNodeCollection();
    
                foreach (var menu in amberMenu)
                {
                    var node = CreateTreeNode(menu.Key.ToString(), "-1", queryStrings, menu.Value, "icon-presentation", true);
                    var nodeTest = CreateTreeNode("1", "1", queryStrings, "Warehouses", "icon-presentation", false, "Test/testTree/index");
                    nodes.Add(node);
                }
    
                return nodes;
            }
    
            throw new NotSupportedException();
            return new TreeNodeCollection();
        }
    
        protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
        {
            var menu = new MenuItemCollection();
    
            if (id == Constants.System.Root.ToInvariantString())
            {
                menu.Items.Add(new CreateChildEntity(Services.TextService));
                menu.Items.Add(new RefreshNode(Services.TextService, true));
               return menu;
            }
            return menu;
    
            return null;
        }
    
        protected override TreeNode CreateRootNode(FormDataCollection queryStrings)
        {
            var root = base.CreateRootNode(queryStrings);
    
            root.Icon = "icon-hearts";
            root.HasChildren = true;
            root.MenuUrl = null;
    
            return root;
        }
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft