2

I would like to change the datasource of treelistEx field in template from

/sitecore/content/Home/Web1/ to datasource=query:./ancestor-or-self::*[@@templateid='{F045A478-2CEC-4333-970D-808DC9FFE9BC}' or @@templateid='{179A1E0B-53A1-4AA4-B25E-ADB6F0D9CD5C}']/*

I found that TreeList, TreeListEx and DropTree are not support query: and fast:

Is it possible to do it?

if it possible, How to do it? please help. Thanks.

1

1 Answer 1

4

Treelist and DropTree use a different syntax if you want to stay with the ootb options. The Treelist parameters are explained here: https://doc.sitecore.com/xp/en/developers/102/sitecore-experience-manager/controlling-the-list-of-items-in-a-selection-field.html (check the Treelist parameters section)

You can specify the following parameters:

DataSource: Root item.

DatabaseName: The name of the database containing DataSource.

IncludeTemplatesForSelection: Users can only select items based on this comma-separated list of data template names.

ExcludeTemplatesForSelection: Users cannot select items based on this comma-separated list of data template names.

IncludeTemplatesForDisplay: Users can only navigate items based on this comma-separated list of data template names and IDs.

ExcludeTemplatesForDisplay: Users cannot navigate items based on this comma-separated list of data template names and IDs.

IncludeItemsForDisplay: Users can only navigate items based on this comma-separated list of item names and IDs.

ExcludeItemsForDisplay: Users cannot navigate items based on this comma-separated list of item names and IDs.

AllowMultipleSelection: If yes, users can select the same item more than once.

By using the Datasource in combination with the IncludeTemplatesForSelection and maybe the IncludeTemplatesForDisplay you should be able to get what you want. Note that for the field to work well you have to be able to display all (parent) items in the tree above the ones you want to be able to select (the editors need to able to follow the tree path)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.