Copied to clipboard

Flag this post as spam?

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


  • Dennis 33 posts 238 karma points
    Jul 22, 2014 @ 16:17
    Dennis
    0

    TreeController stops working??

    I have a really wierd issue. I have created a new section and under my new section I have created two nice working trees. Now I would like my third tree, but whatever I do it just wont show up? I am really stuck here, and it's probaly some simple misunderstanding from my side. I really need someone to point at my mistake. Ok here's on of my wokring trees:

    [PluginController("Trapholt")]

        [Tree("Kurateringsprincipper", "CuratorTree", "Kurateringsprincipper", iconClosed: "icon-doc")]

        public class CuratorTreeController : TreeController

        {

            protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)

            {

                var controller = new CuratorApiController();

                var nodes = new TreeNodeCollection();

     

                if (id == Constants.System.Root.ToInvariantString())

                {

                    nodes.AddRange(controller.GetAll().Select(curatorSubject => CreateTreeNode(curatorSubject.Id.ToString(), id, queryStrings, curatorSubject.Title, "icon-user", false)));

                    return nodes;

                }

     

                throw new NotSupportedException();

            }

     

            protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)

            {

                var menu = new MenuItemCollection();

     

                if (id == Constants.System.Root.ToInvariantString())

                {

                    //var menu1 = new MenuItemCollection { DefaultMenuAlias = ActionNew.Instance.Alias };

                    menu.Items.Add<ActionNew>("Opret");

                    menu.Items.Add<ActionRefresh>("Opdater");

                    return menu;

                }

     

                return null;

            }

        }

     

    Here is my tree that is not rendered correct:

    [PluginController("Trapholt")]

        [Tree("Bingokommentare", "BingoCommentTree", "Bingokommentare", iconClosed: "icon-doc")]

        public class BingoCommentTreeController : TreeController

        {

            protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)

            {

                var nodes = new TreeNodeCollection();

                nodes.Add(CreateTreeNode(id, id, queryStrings, "WTF", "icon-user", true));

     

                return nodes;

            }

     

            protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)

            {

                var menu = new MenuItemCollection();

     

                if (id == Constants.System.Root.ToInvariantString())

                {

                    menu.Items.Add<ActionNew>("Opret");

                    menu.Items.Add<ActionRefresh>("Opdater");

                    return menu;

                }

     

                return null;

            }

        }

     

    I really hope someone can help me with this, I am totaly lost!

  • Dennis 33 posts 238 karma points
    Jul 23, 2014 @ 10:34
    Dennis
    100

    I found the soulution!

    It's because Umbraco dosen't rewrite the changes to the tree.config file. I had first given my tree a wrong application path, and after I changed the attributes it didn't reflect this to the tree.config file. So the solution is to either delete the tree node from the tree.config or change the atrributes so they are correct.

    Hope this help anyone else out there :)

Please Sign in or register to post replies

Write your reply to:

Draft