Copied to clipboard

Flag this post as spam?

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


  • John C Scott 473 posts 1183 karma points
    Sep 03, 2012 @ 20:13
    John C Scott
    0

    Custom Section treeHandlerType

    Using 4.8 I'm trying to add a custom section with a tree, and I have 

    I'm not at all certain what the treeHandlerType setting should be.

    I have the following code so far, and this is compiled into a DLL called pps.website.Logic.dll and I wonder if the Handler type should be loadEnquiries or Tree.loadEnquiries

    using System;
    using System.Data;
    using System.Data.Entity;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using umbraco.cms.presentation.Trees;
    using pps.website.Logic.ObjectModel;
    namespace pps.website.Logic.Tree
    {
        public class loadEnquiries : BaseTree
        {
            private DbSet<ef5EnquiryData> enqset;
            public loadEnquiries(string application) : base(application)
    {
                var context = new PpsContext();
                enqset = context.Enquiries;
            }
            protected override void CreateRootNode(ref XmlTreeNode rootNode)
            {
                rootNode.Icon = FolderIcon;
                rootNode.OpenIcon = FolderIconOpen;
                rootNode.NodeType = TreeAlias;
                rootNode.NodeID = "init";
            }
            public override void Render(ref XmlTree tree)
            {
                foreach (ef5EnquiryData enq in enqset)
                {
                    XmlTreeNode xNode = XmlTreeNode.Create(this);
                    xNode.NodeID = enq.Id.ToString();
                    xNode.Text = string.Format("{0} - {1}", enq.Created, enq.Name);
                    xNode.Icon = "enquiry.gif";
                    xNode.Action = "javascript:openEnquiry(" + enq.Id.ToString() + ")";
                }
            }
            public override void RenderJS(ref System.Text.StringBuilder Javascript)
            {
                Javascript.Append(
                    @"
                        function openEnquiry(id) 
                        {
                            parent.right.document.location.href = 'showEnquiry.aspx?id=' + id;
                        }
                    ");
                }
    }

    No matter what I do the break points set on this are never hit and the tree never loads.

    I'm also confused that there are no other rows in these tables. Is there some other way to declare the custom section / tree now? 

     

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Sep 03, 2012 @ 20:16
    Dirk De Grave
    0

    should"nt you be using the trees.config from /config folder instead of db entries, this has changed since v4.8

     

    Cheers,

    /Dirk

  • John C Scott 473 posts 1183 karma points
    Sep 03, 2012 @ 20:25
    John C Scott
    0

    aaah o.k. had missed that change

    do you know what the treeHandlerType should be?

    my guess is

    Tree.loadEnquiries

     

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Sep 03, 2012 @ 20:39
    Dirk De Grave
    0

    yup, that's correct, umbraco concats ddl name, comma and treehandlerassembly name from config (or db)

  • John C Scott 473 posts 1183 karma points
    Sep 06, 2012 @ 11:43
Please Sign in or register to post replies

Write your reply to:

Draft