Sitecore Droptree不会排除项目 [英] Sitecore Droptree won't exclude items

查看:110
本文介绍了Sitecore Droptree不会排除项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在安装Sitecore 8.1.我正在尝试使用droptree字段来允许内容编辑器从项目树中选择一个项目(数据模板A).保证每个有效选择的项目都具有一个或多个不同数据模板(数据模板B)的子项目.根据文档,这应该很容易做到:只需将源设置为参数化数据源即可:

I'm working on a Sitecore 8.1 installation. I'm trying to use a droptree field to allow content editors to pick one item (data template A) from a tree of items. Each item that's a valid selection is guaranteed to have one or more child items of a different data template (data template B). According to the documentation, this should be easy to do: just set the source to either a parameterized datasource:

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

或查询:

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

但是,由于某种原因,该字段似乎忽略除路径以外的任何内容.它将显示树的正确部分,但显示所有项目(包括数据模板B的项目)并允许选择它们.我尝试了[Exclude|Include]TemplatesFor[Selection|Display]的各种排列,但没有一个被证明是有效的.我还尝试使用[@@templatename!='Data Template B']或使用templateid两种方法从查询中排除B.

For some reason, though, the field seems to ignore anything but the path. It will display the correct portion of the tree, but shows all items (including those of Data Template B) and allows them to be selected. I've tried various permutations of [Exclude|Include]TemplatesFor[Selection|Display], none of which has proven effective. I've also tried excluding B from the query using [@@templatename!='Data Template B'] or both approaches with templateid.

除了偶尔模糊地引用droptree不尊重排除的内容外,我没有找到很多与此有关的信息.常见的解决方案似乎是使用带有正则表达式验证的TreeList将其限制为一个选择.这种方法是足够的,但并不是我真正想要的:TreeList UI对于单项选择有点奇怪,我更愿意根本不允许用户选择多个项目,而不是在用户选择项目时抛出验证错误做.

I haven't been able to find a lot of information about this, other than the occasional vague reference to droptree not honoring exclusions. The common solution seems to be using a TreeList with a regex validation to limit it to one selection. This approach is adequate, but not really what I'd prefer: the TreeList UI is a bit weird for single selection, and I'd prefer to just not allow a user to select multiple items at all rather than throwing a validation error when they do.

我可以使用其他一些字段来表示排除条件,但不显示树视图:同样,它是可服务的,但不是主意,因为此处可能存在很多项目,并且树视图为用户提供了一些有用的上下文.

There are a few other fields I could use that honor the exclusions but don't present a tree view: again, serviceable but not idea, as there could potentially be a lot of items here and the tree view provides the user with some helpful context.

我可能会写一个新的字段类型来模仿Droptree,但实际上很荣幸地被排除在外-我很固执,可能这就是我要走的路-但我想先检查一下以确保自己不是只是缺少一些东西.这就是问题所在:在我继续编写自己的代码之前,有人知道过让Droptree成为ExcludeTemplatesForSelection/Display或通过查询进行过滤的方法吗?

I could probably write a new field type that mimics the Droptree but actually honors the exclusion--and I'm stubborn enough that this may be the route I take--but I wanted to check first to make sure I wasn't just missing something. So that's the question: anyone know of a way to make a Droptree honor either ExcludeTemplatesForSelection/Display or filtering by query before I go ahead and write my own?

推荐答案

Sitecore DropTree字段不支持IncludeTemplatesForSelectionIncludeTemplatesForDisplay参数.

Sitecore DropTree field does not support IncludeTemplatesForSelection or IncludeTemplatesForDisplay parameters.

它们仅与TreelistTreelistExMulitlist字段一起使用.

They work only with Treelist, TreelistEx and Mulitlist fields.

您可以使用的是Richard Cabral创建的FilteredTree字段类型.

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

您可以在git中找到它:过滤树由github上的Richard Cabral .

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

这篇关于Sitecore Droptree不会排除项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆