What is the new syntax for the Multinode tree picker in Umbraco 4.9? I upgraded Umbraco from 4.7.1.1 to 4.9. I then upgrade uComponents to 5.0. I know that some of the uComponents stuff are included in 4.9, HOWEVER, all of our Razor Macros that use the MultiNode Tree picker are not showing up correctly. They don't pull the @Model.Names or other properties. We were using a using statement "using uComponents.Core" but now to my understanding it should just be "using uComponents". But that did not seem to fix our issue. Any ideas are greatly appreciated.
Here is our code below.
@using System.Linq;
@using System.Xml.Linq;
@using umbraco.BusinessLogic;
@using umbraco.MacroEngines;
@inherits umbraco.MacroEngines.DynamicNode
@inherits umbraco.MacroEngines.DynamicNodeContext
@using uComponents
@using umbraco.cms.businesslogic.datatype
@using System.Xml.XPath
@using DWTBlog;
@*Top level navigation new structure*@
@{
var mainNavi = @Model.NodeById(13955);
<div id="mainNavTop">
<nav class="left">
<ul id="mainNav">
@foreach (var x in @mainNavi.mainNavigationPicker)
{
var page = @Model.NodeById(x.InnerText);
var firstSubLevel = page.Children.Where("template!=0").Where("Visible");
var selected = Array.IndexOf(Model.Path.Split(','), page.Id.ToString()) >= 0 ? " class=\"selected\"" : "";
<[email protected](selected)>@NavLevel(@page)
@*--first Sub Level--*@
@if (firstSubLevel.Count() > 0)
{
<ul class="subNavFirst">
@foreach (var secondPage in firstSubLevel)
{
var subSelect = Array.IndexOf(Model.Path.Split(','), secondPage.Id.ToString()) >= 0 ? " class=\"selected\"" : "";
<[email protected](subSelect)>@NavLevel(@secondPage)
@*--2nd Level Sub nav--*@
@if (@secondPage.Children.Where("Visible").Count() > 0 && @secondPage.Where("Visible"))
{
if (@secondPage.Where("!hideChildPagesFromMainNav"))
{
<ul class="subNavSecond">
@foreach (var thirdPage in @secondPage.Children.Where("Visible"))
{
var subSelected = Array.IndexOf(Model.Path.Split(','), thirdPage.Id.ToString()) >= 0 ? " class=\"selected\"" : "";
<[email protected](subSelected)>@NavLevel(@thirdPage)</li>
}
</ul>
}
}
@*--End second level nav if--*@
</li>
}
<li class="subNavBottom"><img src="/media/1944/MenuBgShadowBottom.png" alt="" /></li>
</ul>
}
</li>
}
</ul>
</nav>
</div>
<!-- END MAIN NAV -->
}
@helper NavLevel(dynamic page)
{
if(page.NodeTypeAlias == "Redirect")
{
if (page.HasValue("alternateNavigationName"))
{
<a href="@page.redirectURL">@page.alternateNavigationName</a>
}
else
{
<a href="@page.redirectURL">@page.Name</a>
}
}
else
{
if (page.HasValue("alternateNavigationName"))
{
<a href="@page.Url">@page.alternateNavigationName</a>
}
else
{
<a href="@page.Url">@page.Name</a>
}
}
}
OK I figured this out. If your content does not show up after upgraded to Umbraco 4.9 using the Multi Node Tree Picker
If anyone else wants to know.
After you have installed uC 5.0 and/or upgraded from 4.7.+ to 4.9+. refresh your Datatypes folder. This should show you the newest nodes that uC 5.0 installed or are now rolled into Umbraco. If not, made a new fake datatype and the new datatypes should show in the drop list.
For Multi-Node Tree Picker. To get them working again if you data is not outputting correctly or not at all.
1. Go to your Razor script file and change the "using uComponents.Core" to "using uComponents". Not sure if this matters in the Multi Node Tree Picker case that rolled into Umbraco. Anyways...
2. Go to your Datatype that uses the uComponents: Multi-Node Tree Picker and changed it to Multi-Node Tree Picker > Save
3. Go the the Document Type that uses the Multi-Node Tree Picker data type and resave it.
4. For good measure. Go to your Content node that uses the Doc Type that uses the MNTP Data type and resave that.
Carlos, thanks so much for sharing your solution... so many people just leave posts like 'solved' and provide no details for the rest of us to learn from.
There is a small issue with the uQuery stuff though in Razor I found today. but it may be my build, but seems like the 'HasProperty' does not work. So if you have a Macro that uses uQuery along with the MNTP you may, or may not run into issues. This may just be an bug in general, so the solution above may work in most cases. If you happen to know the answer to my post http://our.umbraco.org/projects/backoffice-extensions/ucomponents/questionssuggestions/35494-Umbraco-49-and-uQuery, that would be awesome. If not, glad I could help.
Umbraco 4.9 and uComponents 5.0
What is the new syntax for the Multinode tree picker in Umbraco 4.9? I upgraded Umbraco from 4.7.1.1 to 4.9. I then upgrade uComponents to 5.0. I know that some of the uComponents stuff are included in 4.9, HOWEVER, all of our Razor Macros that use the MultiNode Tree picker are not showing up correctly. They don't pull the @Model.Names or other properties. We were using a using statement "using uComponents.Core" but now to my understanding it should just be "using uComponents". But that did not seem to fix our issue.
Any ideas are greatly appreciated.
Here is our code below.
OK I figured this out. If your content does not show up after upgraded to Umbraco 4.9 using the Multi Node Tree Picker
If anyone else wants to know.
After you have installed uC 5.0 and/or upgraded from 4.7.+ to 4.9+. refresh your Datatypes folder. This should show you the newest nodes that uC 5.0 installed or are now rolled into Umbraco. If not, made a new fake datatype and the new datatypes should show in the drop list.
For Multi-Node Tree Picker. To get them working again if you data is not outputting correctly or not at all.
1. Go to your Razor script file and change the "using uComponents.Core" to "using uComponents". Not sure if this matters in the Multi Node Tree Picker case that rolled into Umbraco. Anyways...
2. Go to your Datatype that uses the uComponents: Multi-Node Tree Picker and changed it to Multi-Node Tree Picker > Save
3. Go the the Document Type that uses the Multi-Node Tree Picker data type and resave it.
4. For good measure. Go to your Content node that uses the Doc Type that uses the MNTP Data type and resave that.
Boom! everything should be peachy.
Carlos, thanks so much for sharing your solution... so many people just leave posts like 'solved' and provide no details for the rest of us to learn from.
H5YR!
@bob
There is a small issue with the uQuery stuff though in Razor I found today. but it may be my build, but seems like the 'HasProperty' does not work. So if you have a Macro that uses uQuery along with the MNTP you may, or may not run into issues. This may just be an bug in general, so the solution above may work in most cases. If you happen to know the answer to my post http://our.umbraco.org/projects/backoffice-extensions/ucomponents/questionssuggestions/35494-Umbraco-49-and-uQuery, that would be awesome. If not, glad I could help.
is working on a reply...