Copied to clipboard

Flag this post as spam?

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


  • Adriano Fabri 469 posts 1633 karma points
    Apr 24, 2013 @ 16:40
    Adriano Fabri
    0

    Problems when create custom tree node

    Hello,
    I have a problem when I try to add a custom tree node in developer section.
    I'm using umbraco v4.11.06 and I created a custom project to add a custom tree in developer section.
    When I refresh the page, I don't see my custom tree.

    In trees.config this is the line for my Custom Tree Node (It seems OK):
    <!-- Custom -->
    <add silent="false" initialize="true" sortOrder="7" alias="myAlias" application="developer" title="My Custom Tree" iconClosed=".sprTreeFolder" iconOpen=".sprTreeFolder_o" assembly="myCustomTree" type="loadMyCustomTree" action="" />

    What's wrong? Any idea? Thank you in advance.

    This is my class code.

    using System.Text;
    using umbraco.businesslogic;
    using umbraco.cms.presentation.Trees;
    
    namespace MyAliasAppTree
    {
        [Tree("developer""myAlias""My Custom Tree"".sprTreeFolder"".sprTreeFolder_o"""falsetrue, 7)]
        public class loadMyAlias : BaseTree
        {
            public loadClientTools(string application) : base(application)
            { }
    
            protected override void CreateRootNode(ref XmlTreeNode rootNode)
            {
                rootNode.Icon = FolderIcon;
                rootNode.OpenIcon = FolderIconOpen;
                rootNode.NodeType = "init" + TreeAlias;
                rootNode.NodeID = "init";
            }
    
            public override void Render(ref XmlTree tree)
            {
                var mct = XmlTreeNode.Create(this);
                mct.Text = "My Custom Tree";
                mct.Icon = "images/myCustomTree.gif";
                mct.Action = "javascript:openMyCustomTree()";
                // Add the node to the tree
                tree.Add(mct);
            }
    
            public override void RenderJS(ref StringBuilder Javascript)
            {
                Javascript.Append(@"
                   function openMyCustomTree() 
                   {
                       parent.right.document.location.href = 'plugins/MyCustomProject/myPage.aspx';
                   }
               ");
            }
        } 
    }

     

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Apr 25, 2013 @ 09:48
    Dave Woestenborghs
    100

    In your config file the type doesn't match the type in the code example.

    Type should be "MyAliasAppTree.loadMyAlias"

    Dave

Please Sign in or register to post replies

Write your reply to:

Draft