Copied to clipboard

Flag this post as spam?

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


  • Rohan 104 posts 161 karma points
    Jan 20, 2018 @ 09:37
    Rohan
    0

    how to show selected content picker name or it's property name in Content node list view for child items

    Hi

    This is Rohan Dave.

    I am showing List view in Umbraco backoffice Content for some specific Content node.

    Ex. 1) I have "Team" as root document type with "List view enable" for child items. Underneath it i have "Team Details" documnet type which is child document with "Team Name" as property. From "Content -> Team" and i have added 3 teams in it and showing ok in List view.

    2) Now i have another document type "Team Leaders" is root type with "List View enable" for child items. Underneath it i have "Team Leader Details" document type which is child document with "Team Leader Name" as textControl property and "Team" as Content Picker. So i can select team against each leader. Up to this all working ok.

    Now for "Team Leaders" listview i need to show "Team" name as well but right now it's showing blank or "umb://document" etc. I want to show Team name in list view. See the attached screen shot for reference.

    Any help would be appreciated. !

    thanks in advance ! rohanenter image description here

  • Jim 14 posts 57 karma points
    1 week ago
    Jim
    0

    @Rohan, did you have any luck with this? I have the exact same need.

  • Rohan 104 posts 161 karma points
    6 days ago
    Rohan
    0

    Hi Jim

    No i didn't find the way.

    If you come across any solution then please share with me.

    Thanks, Rohan

  • Marcio Goularte 222 posts 687 karma points
    6 days ago
    Marcio Goularte
    0

    you can do this in the contentservice saving.

    https://our.umbraco.org/Documentation/Reference/Events/ContentService-Events

      using Umbraco.Core;
        using Umbraco.Core.Services;
        using Umbraco.Core.Models;
        using Umbraco.Core.Events;
    
    
        namespace Mynamespace
        {
            public class UmbracoEvents : ApplicationEventHandler
            {
    
                protected override void ApplicationStarted(UmbracoApplicationBase umbraco, ApplicationContext context)
                {
    
                    ContentService.Saving += Saving;
    
                }
    
                private void Saving(IContentService sender, SaveEventArgs<IContent> e)
                {
                    foreach (var entity in e.SavedEntities)
                    {
                        if (entity.ContentType.Alias == "myAlias")
                        {
                            Udi id = entity.GetValue<Udi>("picker");
    
                            var guidUdi = id as GuidUdi;
                            if (guidUdi != null)
                            {
                                var content = sender.GetById(guidUdi.Guid);
    
                                if (content != null)
                                    entity.SetValue("teamName", content.Name);
                            }
    
    
                        }
                    }
                }
            }
        }
    
  • Rohan 104 posts 161 karma points
    5 days ago
    Rohan
    0

    Hi

    thanks for information.

    i will check with the way you mentioned.

    thanks,

    rohan

  • Marcio Goularte 222 posts 687 karma points
    5 days ago
    Marcio Goularte
    0

    I forgot to mention. This teamName property is a label. use it in the listview. Only problem with using this approach and when the team name is updated. you would also need to update the column.

    UPDATE

    An alternative is to make your own listview

    https://24days.in/umbraco-cms/2016/custom-list-view-layouts/

Please Sign in or register to post replies

Write your reply to:

Draft