Copied to clipboard

Flag this post as spam?

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


  • Giorgos Grispos 145 posts 179 karma points
    Jul 21, 2011 @ 10:21
    Giorgos Grispos
    0

    Display custom field next to node name in the node tree

    Hello all,

    I know it sounds very custom, but just I'd like to know if there is a solution on that.

    I have a custom field called "nodeCategory", is there anyway to display that field next to the node name within the node tree under th econtent section.

    ie.
    - Home
    -- Articles
    --- Node name (nodeCategory)

    something like that...

    Cheers, Giorgos

  • Sean Mooney 131 posts 158 karma points c-trib
    Jul 21, 2011 @ 14:37
    Sean Mooney
    1

    You can to alter the node text using the BaseTree.BeforeNodeRender event (http://www.richardsoeteman.net/PermaLink,guid,f470b6cf-40da-4aa9-a0d9-7b984fe9bf59.aspx)

    Something like this (I haven't tested this, but I am doing something similar):

    Private Sub BaseContentTree_BeforeNodeRender(ByRef sender As XmlTree, ByRef node As XmlTreeNode, ByVal e As EventArgs)
            If (node.NodeType.ToLower() = "content") Then
                Dim d As New Document(node.NodeID)
                Dim u As User = umbraco.BusinessLogic.User.GetCurrent()
    
                If d IsNot Nothing AndAlso d.ContentType.Alias = "Page" Then
                    node.Text = d.Name &" ("& d.getProperty("nodeCategory").Value &")"
                End If
    
            End If
    End Sub
    
  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jul 21, 2011 @ 15:18
    Tom Fulton
    0

    Hi,

    Here's also a blog post explaining the same idea using similar code that Sean posted.  It shows how to show the value of a datepicker next to the node name in the tree:

    Modifying Tree Node Text in the Umbraco Backend

    -Tom

  • Giorgos Grispos 145 posts 179 karma points
    Jul 21, 2011 @ 16:12
    Giorgos Grispos
    0

    Thanks both of you,

    It seems that can be done, I just need to try this out.

    Cheers, Giorgos

  • Giorgos Grispos 145 posts 179 karma points
    Jul 28, 2011 @ 10:31
    Giorgos Grispos
    0

    Hello,

    I have it ready

    Following that Tom's post was a good way to start.

    Actually was a bit more complex because there was just the nodeId in the the record. So I needed to bring the category name from the nodeId. And some nodes have more than one categories. Anyway we did the job.

    Cheers guys, Giorgos

Please Sign in or register to post replies

Write your reply to:

Draft