Copied to clipboard

Flag this post as spam?

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


  • James Feeney 26 posts 166 karma points
    Dec 05, 2013 @ 12:51
    James Feeney
    0

    MNTP coming up empty

    Hi - I've got a small issue with the Multi Node Tree Picker that I'd like some help with,

    Umbraco v6.1.6 (Assembly version: 1.0.5021.24867)
    Installed uComponents v6.0
    Created Data Type and added property 'gridSelection' to homepage.
    Setup everything, all looks good:



    Gone to Content Area and chosen nodes that I've defined as selectable, which makes my list on the left.
    Publishes fine. I can journey away from this admin page and when I return the selected nodes are still there.
    So I assume these Node IDs are saved in this Property 'gridSelection' for Homepage.

    Have tried numerous ways of iterating through these selected nodes, thinking I was using the wrong one. However, the first line checks whether this property is empty or not. It stops there because I think it thinks the property is empty. But returning to the Content Area I can see my selected list??

    Have tried 'gridSelection' & 'GridSelection' in HasValue.

    Im using the macro below:

    @using umbraco.MacroEngines
    @using umbraco;
    @inherits umbraco.MacroEngines.DynamicNodeContext    
    @{
        if (Model.HasValue("gridSelection"))
        {
            int[] nodeList = uQuery.GetXmlIds(Model.GridSelection.ToXml());      
            IEnumerable<DynamicNode> PublishedNodeList = Library.NodesById(nodeList.ToList());        
            PublishedNodeList = PublishedNodeList.Where(x => x.GetType() != typeof(DynamicNull) && x.Id > 0);                        
            dynamic multiNodeTreePicker = new DynamicNodeList(PublishedNodeList);
    
            if (multiNodeTreePicker.Any())
            {
                foreach (var item in multiNodeTreePicker.Where("Visible"))
                {                   
                    <p>@item.Name</p>      
                }               
            }
        } 
    }



    Any help would be much appreciated. Thanks

Please Sign in or register to post replies

Write your reply to:

Draft