I want to set Multi Node Tree Picker to only show direct ancestors of the current page but the recommended query shows the entire tree
$current/ancestor::*
I want to set Multi Node Tree Picker to only show direct ancestors of the current page but the recommended query shows the entire tree
$current/ancestor::*
I would try to avoid xpath and use dynamic root. XPath is deprecated and removed in Umbraco 14+.
Good point, thank you @LuukPeters
You could try⌠$current/parent::*
or $current/ancestor::*[1]
(to note, XPath is 1-index based not zero).
$current/ancestor::[1] and $current/parent:: both seem to filter to only the current page
$current/ancestor::* shows all the ancestors but their siblings as well and I donât want the user to choose outside the section they are in. I could make a few for each root I guess but that seems very WET.
I also tried
$current/ancestor::*[not(preceding-sibling::*) and not(following-sibling::*)]
to exclude the siblings.
I think it has to be done with a custom query and Dynamic Root and more so v14 onwards I guess
Hi Dean
The XPath for a Multi Node Tree Picker selects the parentnode of the subtree you want to select from⌠which nodes do you want to be able to select in the MNTP?
Or to put in another way: If your goal is to allow selecting any of the current nodeâs ancestors, I think youâll need to install Leeâs Contentment package and use the DataList picker with the âUmbraco Content by XMLâ data source - that one lets you specify an XPath expression for the selectable nodes, which sounds like your goal?
/Chriztian
Thanks @greystate
I have created a nested navigation and allowed the user to choose the starting node.
This works fine out of the box but presents the user with the entire tree.
However, I was trying to restrict the choice to âonly direct ancestorsâ.
I though there may be an âoff the shelfâ option, but there is not, therefore I thought it could be easily done using xpath but the recommended queries I could find donât seem to work with mntp.
As this is v13 I think I will wait and see what is possible in 14+.