Copied to clipboard

Flag this post as spam?

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


  • Lee Higgitt 9 posts 90 karma points
    Jun 17, 2020 @ 08:21
    Lee Higgitt
    0

    Tree Group sort order in the settings section of the back office

    Hi All!

    Hoping you can shed some light on how I can change the sort order of a tree group in the back office.

    I have 2 tree controllers, each with a single node that I return using "CreateRootNode".

    When I run my umbraco project my tree group appears before the vanilla "Settings" tree group, see below: Trees

    I'm trying to get my tree group to appear after "Settings".

    I assume that it was the SortOrder parameter on the "Tree" attribute (applied to the tree controller) but I've played about with this and it hasn't changed anything. I've also taken a look at the uSync source code as Kevin has achieved what I'm attempting to achieve and all I can see that he's done is specify the sort order, which again does nothing for me.

    here's one of my tree controllers:

    [Tree(
            global::Umbraco.Core.Constants.Applications.Settings, 
            Constants.Trees.Configuration.ALIAS, 
            TreeGroup = Constants.Trees.GROUP_NAME, 
            TreeTitle = Constants.Trees.GROUP_NAME, 
            SortOrder = 34)]
        [PluginController(Constants.PACKAGE_ID)]
        public class ConfigurationTreeController : TreeController
        {
            /// <inheritdoc />
            protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings) => new TreeNodeCollection();
    
            /// <inheritdoc />
            protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings) => null;
    
            /// <inheritdoc />
            protected override TreeNode CreateRootNode(FormDataCollection queryStrings)
            {
                var routePath = $"{Constants.PACKAGE_ID}/{Constants.Trees.Configuration.ALIAS}/index";
    
                var node = base.CreateRootNode(queryStrings);
                node.RoutePath = routePath;
                node.Icon = Constants.Trees.Configuration.ICON;
                node.HasChildren = false;
                node.MenuUrl = null;
                node.Name = Constants.Trees.Configuration.ALIAS;
                return node;
            }
        }
    

    All in all throrughly confuddled and would appreciate any help anyone is able to provide!

    Thanks,

    Lee

  • Axel Dalbard 3 posts 73 karma points
    Aug 03, 2023 @ 08:44
    Axel Dalbard
    0

    Hi Lee,

    Did you ever solve this issue :) ? Currently experiencing the same problem now.

    All the best,

    /Axel

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Aug 03, 2023 @ 12:32
    Huw Reddick
    1

    I believe Lee was incorrect in his assumption that uSync had achivied it, The uSync node appears where it does because it is in a group called "Synchronization"

    Having a quick glimpse at the code it would appear that on the Settings tree it is ignoring the sortorder and orders by groups alphabetically

  • Axel Dalbard 3 posts 73 karma points
    Aug 03, 2023 @ 12:36
    Axel Dalbard
    0

    After some experimentation I came to that realization as well. I find this kind of strange, what is the purpose of the sortOrder parameter then?

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Aug 03, 2023 @ 13:21
    Huw Reddick
    0

    It is used by other trees just not this one.

Please Sign in or register to post replies

Write your reply to:

Draft