eli.rodriguez
eli.rodriguez

Reputation: 490

Cant render umbraco Custom Tree

I am creating a new Section in umbraco 4.8 so now i want to create a custom tree for that section. Here is the Register of the section

sortOrder | appAlias | appIcon   | appName   | appInitWithTreeAlias
9         |importer  |import.gif |  Importer | NULL

This is the the register for the tree of that section

treeSilent = False
treeInitialize = True
treeSortOrder = 0
appAlias = importer
treeAlias = importer
treeTitle = Importer
treeIconClosed = legacy
treeIconOpen = legacy
treeHandlerAssembly = asm.ssu.importer // My DLL Name
treeHandlerType = site.com.clients.ssu.importer.loadImporter // Namespace.ClassName
actionn = NULL

And this is my class

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using umbraco.cms.presentation.Trees;

namespace site.com.clients.ssu.importer
{
    public class loadImporter : BaseTree
    {
        public loadImporter(String application)
            : base(application)
        {

        }

        protected override void CreateRootNode(ref XmlTreeNode rootNode)
        {
            rootNode.Icon = FolderIcon;
            rootNode.OpenIcon = FolderIconOpen;
            rootNode.NodeType = TreeAlias;
            rootNode.NodeID = "init";
        }

        public override void RenderJS(ref System.Text.StringBuilder Javascript)
        {
            Javascript.Append(
            @"
                function openImporter(id)
                {
                    parent.right.document.location.href = '#' ;
                }    
            ");
        }

        public override void Render(ref XmlTree tree)
        {
            XmlTreeNode xNode = XmlTreeNode.Create(this);
            xNode.NodeID = "1";
            xNode.Text = "Import Site";
            xNode.Icon = "importer.gif";
            xNode.Action = "javascript:openImporter(1)";
            tree.Add(xNode);      
        }
    }
}

As you see i just need to render it but when i click into the section and touch the config it should render just one child but does not render nothing , any idea ?

Upvotes: 0

Views: 1105

Answers (2)

bygrace
bygrace

Reputation: 5988

Things changed in 4.8. You might find this usefull: http://blog.mattbrailsford.com/2012/07/18/creating-custom-applications-and-trees-in-umbraco-4-8/

Theoretically it is supposed to be backwards compatible from what I hear. Your configuration looks right. The only difference is that I only put the class name for treeHandlerType rather than the fully qualified name.

Upvotes: 0

Bruce
Bruce

Reputation: 11

When it renders nothing it's normally because an error is being thrown but suppressed. This is likely to be one of the following:

  • It can't load the tree due to a mismatch in the specified type and assembly
  • The class has thrown an error that's being suppressed.

If you check the umbracoLog table in the database the actual error should be recorded in there.

Upvotes: 1

Related Questions