Sitecore droptree will not exclude items

I am working on installing Sitecore 8.1. I am trying to use the droptree field so that content editors can select one element (data template A) from the element tree. Each element for which a valid selection is guaranteed to have one or more children from another data template (data template B). According to the documentation, this should be easy to do: just install the source with either a parameterized data source:

Datasource=/sitecore/Media Library/Images/Folder&IncludeTemplatesForDisplay=Data Template A 

or request:

 query:/sitecore/Media Library/Images/Folder/*[@@templatename='Data Template A'] 

For some reason, the field seems to ignore everything except the path. It will display the correct part of the tree, but will display all the elements (including data template B) and let them select. I tried various permutations of [Exclude|Include]TemplatesFor[Selection|Display] , none of which proved to be effective. I also tried to exclude B from the query using [@@templatename!='Data Template B'] or both approaches with templateid .

I have not been able to find much information about this, except for the occasional vague reference to droptree not observing the exception. A common solution is to use a TreeList with regular expression validation to limit it to one choice. This approach is adequate, but not quite what I would prefer: the TreeList interface is a bit weird for one choice, and I would rather just not let the user select multiple elements at all, and not throw a validation error when they are done.

There are several other fields that I could use to observe exceptions, but I can’t imagine the tree view: again, healthy, but not an idea, since there could potentially be many elements, and the tree view provides the user with some useful context.

Perhaps I could write a new type of field that imitates Droptree, but it really distinguishes an exception - and I'm stubborn enough that this may be the route I take, but I wanted to check first to make sure that something wasn’t enough. So the question is: does anyone know a way to honor Droptree either by ExcludeTemplatesForSelection / Display, or filter by request before I go ahead and write my own?

+6
source share
1 answer
Field

Sitecore DropTree does not support IncludeTemplatesForSelection or IncludeTemplatesForDisplay .

They work only with the Treelist , TreelistEx and Mulitlist .

What you can use is the FilteredTree field type created by Richard Cabral.

You can find it from git here: Filtered Tree from Richard Cabral on github .

+6
source

All Articles