Copied to clipboard

Flag this post as spam?

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

  • James Russell 6 posts 78 karma points
    Aug 09, 2018 @ 11:30
    James Russell

    Creating custom umbraco tree using document types

    Hello chaps,

    First post hope its ok.

    So I'm currently extending the back office with a custom section and consequently a custom tree. I've managed to get it working nicely and have populated the tree nodes with a matching edit.html for each one.

    Here is the tree code:

        protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
            var nodes = new TreeNodeCollection();
            if (id == Constants.System.Root.ToInvariantString())
                nodes.Add(CreateTreeNode(BookingSystemNodes[0], id, queryStrings, BookingSystemNodes[0], "icon-home color-green", true));
            else if (id == "Dealer")
                nodes.Add(CreateTreeNode(BookingSystemNodes[1], id, queryStrings, BookingSystemNodes[1], "icon-calendar-alt", true, $"BookingSystem/BookingSystemTree/dashboard-edit/{BookingSystemNodes[1]}"));
            else if (id == "Dashboard")
                nodes.Add(CreateTreeNode(BookingSystemNodes[2], id, queryStrings, BookingSystemNodes[2], "icon-newspaper-alt", false, $"BookingSystem/BookingSystemTree/landing-edit/{BookingSystemNodes[2]}"));
                nodes.Add(CreateTreeNode(BookingSystemNodes[3], id, queryStrings, BookingSystemNodes[3], "icon-user-glasses", false, $"BookingSystem/BookingSystemTree/genius-edit/{BookingSystemNodes[3]}"));
            return nodes;

    Here is the front end of the back office: enter image description here

    My question is; how would I create the 'Genius Landing Page' & 'Genius' nodes as a custom document type/s? (And then have the ability to add more by r-click on 'Genius Dashboard' and add them as children).

    Im thinking you might be able to overload the createTreeNode method to accept a document type to base the node on (umbraco entity)?

    Any help would be great, Thanks.

  • Louis Ferreira 69 posts 265 karma points
    Aug 09, 2018 @ 12:13
    Louis Ferreira

    Hi James,

    Nice extension!

    The way I would approach this is to create a custom tree node action, then in that custom dialog, add ui elements that calls the TreeService to add/edit nodes (similar to the built in 'Create', 'Delete' context menus). You could then pass up params based on which menu item was clicked in order to know what type of document to create.

    Here a good starting point on tree actions

    Also see the TreeService API


  • Louis Ferreira 69 posts 265 karma points
    Aug 09, 2018 @ 12:16
  • James Russell 6 posts 78 karma points
    Aug 09, 2018 @ 12:48
    James Russell

    Thanks! I'll take a look, that sounds like what I'm after.

Please Sign in or register to post replies

Write your reply to: