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 @ 17:57
    Iain Martin
    0

    Double Rendering of tree

    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 iedeas what I am doing wrong?

  • Rich Green 2246 posts 4008 karma points
    Sep 08, 2011 @ 19:07
    Rich Green
    0

    Hi,

    You need to set an unique ID for each node, then this problem should go away.

    Rich

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

    Cheers Rich, I actually found this in one of the other forums a couple of pages in and have done this and it works okay now. I was following the geckonewmedia tutorial which doesn't do this step so I'll blame him and not me!

Please Sign in or register to post replies

Write your reply to:

Draft