cloudscribe/cloudscribe.Web.Navigation

Let View Component determine the NavigationTreeBuilder to use

Closed this issue · 2 comments

Please let the View Component determine the NavigationTreeBuilder to use so that you can have multiple NavigationTreeBuilder. One for side bar and one for the top bar.

Take a look at the highlighted code.

@await Component.InvokeAsync("Navigation", new { viewName = "BootstrapTopNav", filterName = NamedNavigationFilters.TopNav, startingNodeKey = "", TreeBuilder = "XmlNavigationTreeBuilder" })

Sorry but no, it doesn't work like that.

XmlNavigationTreeBuilder is not the name of a treebuilder instance, it is the name of the type.

You should define your side bar nodes in the same xml as other nodes.

You can use the componentVisibility property on the nodes which corresponds to filterName when you invoke the component.

So a node like this:

<NavNode key="SomeNodekey" 
    controller="SomeController" 
    action="SomeAction" 
    text="Some Text" componentVisibility="sidebar">
    <Children />

that node will ONLY be visible when you pass "sideBar" as the filter name. If you want the node visible in other views you can make comma separate in componentVisibility.

And for your case for sidebar you may want to pass the starting node key if all the sidebar nodes are under one parent node.

oh Ok. Thanks for your support.