Copied to clipboard

Flag this post as spam?

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


  • Daniel Bardi 927 posts 2562 karma points
    Jan 15, 2011 @ 09:44
    Daniel Bardi
    0

    Custom tree is not rendering in 4.6.1

    I have a custom tree built in 4.0... I am converting it to work in 4.6.1... 

    I have all the javascript stuff worked out and all other default section trees render fine.

    The Render method for my custom tree is never hit.

    The CreateRootNode, CreateRootNodeActions, and RenderJS methods are hit, but never the Render.

    What am I doing wrong?

  • Daniel Bardi 927 posts 2562 karma points
    Jan 15, 2011 @ 19:44
    Daniel Bardi
    0

    All my actions load fine, but the tree is not rendering... The Render method is never hit.

    What's happening to me.. I'm pulling my hair out.

    These are my CreateRootNode, CreateRootNodeActions, Render, and RenderJS methods:

    /// <summary> /// Creates the root node. /// </summary> /// <param name = "rootNode">The root node.</param> protected override void CreateRootNode(ref XmlTreeNode rootNode) { var userRootPath = FileManagerConfig.CurrentUserRootUrl; rootNode.Text = string.Format("Root - [ {0} ]", userRootPath); rootNode.Icon = Constants.FolderTreeIcon; rootNode.OpenIcon = Constants.FolderTreeIcon; rootNode.NodeType = "initFileman"; //TreeAlias; rootNode.NodeID = userRootPath; rootNode.Action = string.Format("javascript:viewFolder('{0}')", rootNode.NodeID); } /// <summary> /// Creates the root node actions. /// </summary> /// <param name = "actions">The actions.</param> protected override void CreateRootNodeActions(ref List<umbraco.interfaces.IAction> actions) { actions.AddRange(Menus.RootFolderMenu); actions.Add(ContextMenuSeperator.Instance); actions.Add(ActionRefresh.Instance); } /// <summary> /// Renders the specified tree. /// </summary> /// <param name = "tree">The tree.</param> public override void Render(ref XmlTree tree) { var rootDirectoryInfo = NodeKey == string.Empty ? new DirectoryInfo(FileManagerConfig.CurrentUserRootPath) : new DirectoryInfo(NodeKey); BuildFileManagerTree(rootDirectoryInfo, tree); } /// <summary> /// Renders the JavaScript to open file editor. /// </summary> /// <param name = "javascript">The javascript.</param> public override void RenderJS(ref StringBuilder javascript) { // Folder Viewer Function if (IsDialog) { javascript.Append(@" /* Node action to select folder */ function viewFolder(folder) { if (parent.opener) {parent.opener.dialogHandler(folder);} else {parent.dialogHandler(folder);} }"); } else { if (javascript.ToString() == "{}") { javascript = new StringBuilder(); } javascript.Append(@" /* File Node Actions - Generated from <filePages> in '~/config/fileManager.config' */"); var fileOpeners = FileManagerConfig.FileOpeners; foreach ( var value in from fileOpener in fileOpeners where fileOpener.Page != String.Empty select Util.GetJsFunction(fileOpener)) { javascript.AppendLine(value); } // Default File Function javascript.AppendFormat(@" /* Default File Node Action - Generated from <filePages> in 'fileManager.config' */ function {0}(file) {{ parent.right.document.location.href = '{1}/Pages/{2}?file=' + file; }}", FileManagerConfig.DefaultFileFunction, Constants.FileManagerGlobalUrl, FileManagerConfig.DefaultFilePage); javascript.AppendLine(); // Folder Viewer Function javascript.AppendFormat(@" /* Folder Node Action */ function viewFolder(folder) {{ parent.right.document.location.href = '{0}/Pages/FolderViewer.aspx?folder=' + folder; }}", Constants.FileManagerGlobalUrl); javascript.AppendLine(); // Umbraco Functions javascript.Append(@" /* Umbraco Node Actions - Used when <umbracoTrees> are enabled in 'fileManger.config' */ function openMedia(id) { parent.right.document.location.href = 'editMedia.aspx?id=' + id; } function openStylesheet(id) { parent.right.document.location.href = 'settings/stylesheet/editStylesheet.aspx?id=' + id; } function openTemplate(id) { parent.right.document.location.href = 'settings/editTemplate.aspx?templateID=' + id; } function openScriptEditor(file) { parent.right.document.location.href = 'settings/scripts/editScript.aspx?file=' + file; } function openPython(file) { parent.right.document.location.href = 'developer/python/editPython.aspx?file=' + file; } function openXslt(file) { parent.right.document.location.href = 'developer/xslt/editXslt.aspx?file=' + file; }"); } }

  • Daniel Bardi 927 posts 2562 karma points
    Jan 16, 2011 @ 00:31
    Daniel Bardi
    0

    I am desperate at this point... Can anyone please assist.  I honestly don't know what I am missing.

  • Vincent Baaij 95 posts 344 karma points c-trib
    Jan 17, 2011 @ 09:27
    Vincent Baaij
    1

    I was having the same problem with a custom tree not hitting the Render method. Turned out to be caused by using my own TreeAlias. Appearantly the tree is expecting something else. I changed the code so it now uses a default value, 'Render' gets called. Don't know exactly how the default is set though. Think it inherits/gets set by the base tree.

    This is what I use in CreateRootNode:

        rootNode.NodeType = "init" + this.TreeAlias;


    Perhaps something you can give a try.

  • Daniel Bardi 927 posts 2562 karma points
    Jan 17, 2011 @ 17:49
    Daniel Bardi
    0

    This is an upgrade to a project that was working int 4.0... I let it sit for a day.. came back to it and BAM!  It's working now... I'm not sure why it wasn't working, but I don't care now... I'll mark it off as paranormal.  :)

    Vincent,  I'll give you the credit since you are the only one that responded.

Please Sign in or register to post replies

Write your reply to:

Draft