Copied to clipboard

Flag this post as spam?

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


  • Inx51 54 posts 107 karma points
    Feb 05, 2014 @ 12:47
    Inx51
    0

    Custom tree, RenderJS never triggered...

    Hi!

    Just updated my code from 7.0.2 to 7.0.3

    However.. it seems like RenderJS for my custom tree-node wont fire, and there for there is no javascript rendered to the "DOM" and there for I cant use my custom node...

    It shows up perfectly fine, the problem is once I press the node i get an error telling me that openUDevSync isnt found.

    any ideas?

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Web;
    using System.Xml;
    using umbraco.BusinessLogic.Actions;
    using umbraco.cms.businesslogic.language;
    using umbraco.cms.presentation.Trees;
    using umbraco.interfaces;
    using Umbraco.Core;
    using Umbraco.Web.Trees;
    namespace UDev.Core.Trees
    {
        [Tree(Constants.Applications.Developer, "uDev", "UDev")]
        public class UDevTree : BaseTree
        {
            public UDevTree(string application)
                : base(application)
            {
            }
            protected override void CreateRootNode(ref XmlTreeNode rootNode)
            {
                rootNode.NodeType = "uDev";
                rootNode.NodeID = "init";
                rootNode.Menu = null;
                rootNode.Text = "UDev";
            }
            public override void Render(ref XmlTree tree)
            {
                XmlTreeNode xNode = XmlTreeNode.Create(this);
                xNode.NodeID = "uDevSdt";
                xNode.Text = "Sync document types";
                xNode.Action = "javascript:openUDevSync();";
                xNode.Icon = "icon-sync";
                xNode.OpenIcon = "icon-sync";
                xNode.Menu = null;
                tree.Add(xNode);
            }
            public override void RenderJS(ref System.Text.StringBuilder Javascript)
            {
                Javascript.Append(
                    @"
                    function openUDevSync() {
    alert();
                    }");
            }
        }
    }

    And for the record.. this post-editor gets really crazy if you copy paste code from a vs2013 with the dark-theme.. please fix that..

     

    Thanks in advance!

  • Kris 7 posts 27 karma points
    Apr 10, 2015 @ 23:20
    Kris
    0

    necroing this post, but i'm having the same issue.  When I set a breakpoint in RenderJS, it never gets hit.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Apr 10, 2015 @ 23:44
    Jan Skovgaard
    0

    Hi kris

    What version of Umbraco are you seeing this on? Same as the original poster?

    /Jan

  • Kris 7 posts 27 karma points
    Apr 13, 2015 @ 16:46
    Kris
    0

    I'm on Umbraco version 7.2.1 assembly: 1.0.5462.37503

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Apr 14, 2015 @ 09:12
    Dave Woestenborghs
    1

    This code is the legacy version of creating custom trees (pre v7). Since V7 you can inherit from TreeController.

    Have a look here for a example : https://bitbucket.org/dawoe/umbukfestival2014

    Dave

  • Sören Deger 733 posts 2844 karma points c-trib
    Apr 14, 2015 @ 09:24
    Sören Deger
    1

    Hi Kris,

    here is another good example:

    http://www.nibble.be/?p=440

     

    Best,

    Sören

  • Kris 7 posts 27 karma points
    Apr 23, 2015 @ 23:30
    Kris
    0

    Thanks for these links.  I'm able to get my custom section and menu to display  in Umbraco 7, but is there anyway to use a custom Controller and View?  It's hard to tell from the example.  Thanks.

Please Sign in or register to post replies

Write your reply to:

Draft