Copied to clipboard

Flag this post as spam?

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


  • Kevon K. Hayes 255 posts 281 karma points
    Dec 10, 2009 @ 06:33
    Kevon K. Hayes
    0

    How do you get the Create button to work on a Child node?

    I'm trying to create (from my Custom Tree) a child node under a child node. I've read the TREE API http://our.umbraco.org/wiki/reference/backoffice-apis/tree-api---to-create-custom-treesapplications from beginning to end, but it's not clear to me. I'm able to Create a Child node under a Parent/Root node but not under a childnode.

    This is my Root Node:

    -Root (the create button pops up here to and allows me to create a child node...)

    ---ChildNode (but not here) how do I get this   to pop up here...

    ------ChildNode (so that I'll have a new node appear here?)

     

  • Kevon K. Hayes 255 posts 281 karma points
    Dec 10, 2009 @ 16:30
    Kevon K. Hayes
    0

    My apologies for broken image please view it here: http://i8dm.com/images/createnodeimage.png I think this should clarify.  I don't get this menu on none of my child nodes.

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Dec 10, 2009 @ 21:20
    Aaron Powell
    0

    You need to add ActionNew.Instance as an allowed action in the CreateAllowedActions method.

  • Kevon K. Hayes 255 posts 281 karma points
    Dec 11, 2009 @ 06:30
    Kevon K. Hayes
    0

    Not sure if implementing this properly... I added the following:

     

            protected override void CreateAllowedActions(ref List<IAction> actions)
            {
                actions.Clear();
                actions.Add(ActionNew.Instance);
                actions.Add(ActionDelete.Instance);
                actions.Add(ContextMenuSeperator.Instance);

                actions.Add(ActionRefresh.Instance);
                //base.CreateAllowedActions(ref actions);
            }

    Now I get an error: The name 'ActionNew' does not exist in the current context.  Am I missing a namespace?

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

  • Kevon K. Hayes 255 posts 281 karma points
    Dec 11, 2009 @ 06:33
    Kevon K. Hayes
    0

    Actually these are all my references:

    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Data.Sql;
    using System.Data.SqlClient;
    using System.Linq;
    using System.Text;
    using System.Web;
    using umbraco.BusinessLogic;
    using umbraco.cms.presentation.Trees;
    using umbraco.DataLayer;
    using umbraco.interfaces;

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Dec 12, 2009 @ 06:36
    Aaron Powell
    0

    ActionNew is in umbraco.BusinessLogic.Actions, which is part of the cms.dll assembly.

  • Kevon K. Hayes 255 posts 281 karma points
    Dec 13, 2009 @ 05:38
    Kevon K. Hayes
    0

    Thanks slace, all is well now that I've added the correct namespace.  I'm getting the Create and Reload options now However, I have a small issue that I'm trying to work through.  When I go to create a child node under a child node, it gets created as a child of the parent and not a child of a child?

    -root node
    --node (I try to create a new node here)
    --node (it goes here for some reason)
    ---node(and not here)

    Here's my code:

    namespace i8Menus
    {
        public class loadi8MenuTree : BaseTree
        {
            public loadi8MenuTree(string application):base(application)
            {
           
            }

            protected override void CreateRootNode(ref XmlTreeNode rootNode)
            {
                rootNode.Icon = FolderIcon;
                rootNode.OpenIcon = FolderIconOpen;
                rootNode.HasChildren = true;
                rootNode.NodeType = TreeAlias;
                rootNode.NodeID = "init";
            }
                                         
            protected override void CreateAllowedActions(ref List<IAction> actions)
            {
                actions.Clear();
                actions.Add(ActionNew.Instance);
                actions.Add(ActionDelete.Instance);
                actions.Add(ActionMove.Instance);
                actions.Add(ActionSort.Instance);
                actions.Add(ContextMenuSeperator.Instance);

                actions.Add(ActionRefresh.Instance);
                //base.CreateAllowedActions(ref actions);
            }

            public override void RenderJS(ref System.Text.StringBuilder Javascript)
            {
                 Javascript.Append(
                @"
                        function openi8MenuTree(menuID)
                        {
                            parent.right.document.location.href = 'plugins/editi8MenuTree.aspx?menuID=' + menuID;
                        }
                ");

                Javascript.Append(
    @"
                        function openi8SubMenuTree(menuID)
                        {
                            parent.right.document.location.href = 'plugins/editi8SubMenuTree.aspx?menuID=' + menuID;
                        }
                ");
            }


            public override void Render(ref XmlTree tree)
            {
                IRecordsReader reader = Application.SqlHelper.ExecuteReader("SELECT * FROM i8Menus");

                while (reader.Read())
                {
                    // I'm probably missing a statement here...

                    XmlTreeNode xNode = XmlTreeNode.Create(this);
                    xNode.NodeID = reader.GetInt("menuID").ToString();
                    xNode.HasChildren = true;
                    xNode.Text = reader.GetString("menuName");
                    xNode.Icon = "i8TreeIcon.gif";
                    xNode.Action = "javascript:openi8MenuTree(" + reader.GetInt("menuID").ToString() + ")";

                    tree.Add(xNode);
                }

            }
        }
    }

Please Sign in or register to post replies

Write your reply to:

Draft