Umbraco:将项目关联到多个标签组
假设我们有 2 种文档类型:TagGroup [DisplayName]
和 TagGroupItem [DisplayName]
,其中 TagGroupItems 是 TagGroup 的子项。也就是说,假设我们有以下数据:
颜色 - 红色的 - 绿色的 - 蓝色
饰面 - 铝 - 塑料
颜色和表面处理都是标签组。哪种数据类型允许另一个项目与 1 个或多个标签组项目关联?也就是说,一个物品可以是红色和铝饰面,也可以只是红色。除了手动为每个标签组创建下拉菜单并将其关联到一个项目之外,如何才能更加简化?
Assuming we have 2 document types: TagGroup [DisplayName]
and TagGroupItem [DisplayName]
with TagGroupItems being children of TagGroup. That said, assume we have the following data:
Color
- Red
- Green
- Blue
Finish
- Aluminum
- Plastic
Color and Finish are both TagGroups. What kind of data type would allow for the another item to be associated with 1 or more tag group items? That is, an item could be Color-Red and Finish-Alumimum or just Color-Red. Aside from manually creating a drop down for each tag group and associating it to an item, how can this be more streamlined?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试使用伟大的多节点树选取器来做到这一点uComponents 包。
创建基于多节点树选择器的数据类型,将其配置为仅允许选择
TagGroupItems
(使用XPathFilter)。需要与 x
TagGroupItems
关联的每个文档类型只需要一个使用该数据类型的属性。这当然允许从同一个
TagGroup
中选择多个TagGroupItem
(例如红色和绿色)。如果您想强制仅链接 0 个或一个TagGroupItem
,您可以为每个TagGroup
定义一个数据类型,仅限于其
TagGroupItems
和最大节点选择设置为 1。You may try to do this with Multi-Node Tree Picker of the great uComponents package.
Create a datatype based on Multi-node tree picker, configure it to allow only
TagGroupItems
to be selected (using XPathFilter).Every document type which needs to be associated with x
TagGroupItems
then simply needs one property using this datatype.This of course would allow to choose more than one
TagGroupItem
from the sameTagGroup
(for example red and green). If you'd like to enforce having only 0 or oneTagGroupItem
linked, you could define a datatype for eachTagGroup
, limited to theirTagGroupItems
and Maximum node selection set to 1.