Copied to clipboard

Flag this post as spam?

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


  • Iain Martin 54 posts 98 karma points
    Sep 08, 2011 @ 18:08
    Iain Martin
    0

    Rendering of tree nodes

    I am writing my own plugin and have a problem with the tree nodes rendering when moving away and back again to the page. Basically the node text keeps adding on each refresh of the page.

    The code is:

    namespace UmbRecruit
    {
        public class loadRecruit : BaseTree
        {

            public loadRecruit(string application)
                : base(application)
            { }

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


            public override void Render(ref XmlTree Tree)
            {


                var CreateJob = XmlTreeNode.Create(this);
                CreateJob.Text = "Create New Job";
                CreateJob.Icon = "new.png";
                CreateJob.Action = "javascript:openCreateJob()";
                Tree.Add(CreateJob);

                var ViewJobs = XmlTreeNode.Create(this);
                ViewJobs.Text = "View Current Vacancies";
                ViewJobs.Icon = "table.png";
                ViewJobs.Action = "javascript.openViewJobs()";
                Tree.Add(ViewJobs);
       
            }

            public override void RenderJS(ref StringBuilder Javascript)
            {
                Javascript.Append(@"
                    function openCreateJob(){
                        parent.right.document.location.href='plugins/Recruitment/CreateNewJob.aspx';
                       }
                       function openViewJobs(){
                        parent.right.document.location.href='plugins/Recruitment/ViewVacancies.aspx';
                        }
                   ");

            }
        }
    }

    Anybody got any ideas what I am doing wrong?

  • Iain Martin 54 posts 98 karma points
    Sep 08, 2011 @ 18:20
    Iain Martin
    0

    My bad. Found the solution on a previous poster I had missed. Didn't have the unique nodeId set in my code. Did this and it resolved the issue.

     

    BTW - the delete this post button doesn't!

Please Sign in or register to post replies

Write your reply to:

Draft