Multi-Node Tree Picker

The multi-node tree picker data type allows your content editor to choose multiple nodes in the content or media trees to be saved with the current document type. This is useful for all sorts of situations such as relating a page to numerous other pages, creating a list of images/files from the media section, etc... The current version supports:
  • Rendering either the Media or Content tree
  • Choosing a starting node ID for the tree
  • An XPath filter to match the nodes that should, OR should not be clickable/selectable in the tree
  • Thumbnail preview for selected images when working with the media tree
    • Thunbmail preview can be enabled/disabled
  • Set a maximum number of nodes to be selected, by default this is unlimited
  • Information tooltip display for each selected item which can be toggled on/off
    • The tooltip display contains a link to edit the selected item
  • The option to save as valid XML data for easy retrieval even in XSLT, OR saving as CSV (comma seperated values)
  • Drag/Drop sorting of selected nodes

Pre-value editor

MNTP_PreValues.PNG
MNTP_PreValues2.JPG

Data editor

  • The nodes in a light reddish color are nodes that the user is unable to select
  • The list on the right shows which nodes have already been selected/saved
    • These nodes can be sorted by dragging and dropping and can also be removed by clicking the 'x'
MNTP_DataEditor.PNG
  • When informational tooltips are enabled an 'info' icon is displayed next to each of the selected items which when click shows information about the node:
    • The node's ID
    • Path and content Path
    • Edit button which will deep link to that item's editor page
MNTP_DataEditor2.jpg
  • When a node is selected that has already been selected or it is a node that is not allowed to be selected based on the XPath expression defined in the pre-value editor, it will blink red when selected:
MNTP_DataEditor3.jpg
  • When working with the Media tree and thumbnail previews are enabled, the thumbnail of the image will be shown:
MNTP_DataEditor4.jpg

Example of XML data

Here is an example of the XML data that the Multi-node Tree Picker produces:

<MultiNodePicker>
	<nodeId>1052</nodeId>
	<nodeId>1051</nodeId>
	<nodeId>1050</nodeId>
</MultiNodePicker>

XSLT example

The Multi-node Tree Picker data-type will provide XML data based on the nodes you have selected. Here is an example of it's basic usage:

<xsl:template match="/">

	<!--
		uComponents: Multi-node Tree Picker - An XSLT example
		=====================================
		The Multi-node Tree Picker data-type will provide XML data based on the nodes you have selected.
		In this example, the property alias name for the Multi-node Tree Picker is "treePicker".
	-->

	<!-- First we check that the Multi-node Tree Picker has any nodeId values -->
	<xsl:if test="$currentPage/treePicker/MultiNodePicker/nodeId">

		<ul>

			<!-- Loop through each of the nodeId values -->
			<xsl:for-each select="$currentPage/treePicker/MultiNodePicker/nodeId">

				<!-- Since we only have the nodeId value, we need to get the actual content node using umbraco.library's GetXmlNodeById method -->
				<!-- If you prefer to use pure XPath, then used this: "$currentPage/ancestor-or-self::*[@isDoc and @level = 1]/descendant-or-self::*[@isDoc and @id = current()]" -->
				<xsl:variable name="node" select="umbraco.library:GetXmlNodeById(.)" />

				<li>

					<!-- Output the URL using umbraco.library's NiceUrl method -->
					<a href="{umbraco.library:NiceUrl(.)}">

						<xsl:value-of select="$node/@nodeName" />

					</a>

				</li>

			</xsl:for-each>

		</ul>

	</xsl:if>

</xsl:template>

Last edited Sep 12, 2010 at 12:58 PM by Shandem, version 7

Comments

Enz1n0 Sep 6, 2012 at 12:18 PM 
What do you say about multi-level like word press menu?
Would be very very very useful!
Thanks for your work, compliments!

mixfm May 28, 2012 at 6:38 AM 
Hi! Great control, just wondering about the mentioned use on a custom tree tho? How would I go about implementing this? I started to pull apart the source but not sure if I'm missing something as I couldn't get it to work on anything but the media/content trees...

Leonard07 Oct 18, 2011 at 12:31 PM 
Is it possible to render a custom section tree? I have extended umbraco by creating a custom section with its own tree view.

firepol Aug 4, 2011 at 3:32 PM 
Tried v2.1, the drag & drop functionality doesn't work with Internet Explorer. Just the sorting on the right works with IE7 and IE8 (but not in IE9).

halvager Jul 10, 2011 at 12:49 PM 
@Razor example:

=====================================================================

@if (@Model.HasProperty("myProperty") && @Model.GetProperty("myProperty").Value != String.Empty)
{
foreach (var x in @Model.myProperty)
{
var n = @Model.NodeById(@x.InnerText);
}
}
=====================================================================

/Johan

Diplo Jun 21, 2011 at 11:31 AM 
Great control! Any chance of adding Razor snippets alongside XSLT now that Umbraco has support?

brendan_rice Jan 11, 2011 at 2:22 PM 
This control is the dogs bollox. Thumbs up for whoever created it.

nlubbers Sep 24, 2010 at 11:54 PM 
Really nice control!
Is it also possible to show thumsb in correct aspect ratio als widescreen format images are forced to a square now.