简体   繁体   English

不能渲染umbraco自定义树

[英]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. 我正在umbraco 4.8中创建一个新的节,所以现在我想为该节创建一个自定义树。 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 ? 如您所见,我只需要渲染它,但是当我单击该部分并触摸配置时,它应该只渲染一个孩子,但什么也不渲染,有什么想法吗?

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. 如果您检查数据库中的umbracoLog表,则实际错误应记录在其中。

Things changed in 4.8. 情况在4.8中发生了变化。 You might find this usefull: http://blog.mattbrailsford.com/2012/07/18/creating-custom-applications-and-trees-in-umbraco-4-8/ 您可能会发现此有用: 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. 唯一的区别是,我只为treeHandlerType放置了类名,而不是完全限定名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM