2

I want to achieve the Treelist in such a way that it shows up all the ancestors of an item which is derived from the template mentioned in the IncludeTemplatesForSelection parameter of the query.

For Example I have below content Tree. enter image description here

Now, the datasource is the "Datasource" item. I want to show all the "item 1" in the tree for selection(descendants of source). But treelist should not show "Folder 4" since it does not have "Item 1" in it, "Folder 2" should only display "Item 1".

There can be many templates which hold "Item 1" and I cannot add all to ExcludeTemplatesForDisplay parameter.

Is there any way I can achieve this by the Query?

1

1 Answer 1

2

You might be able to achieve this functionality by using datasource parameters. You already mention ExcludeTemplatesForDisplay but have you tried:

  • IncludeItemsForDisplay
    A comma separated list of item names or ids to be shown to author.
    Example use: includeitemsfordisplay=Item 1
  • IncludeTemplatesForDisplay
    A comma separated list of templates names (no ids). Items based on these templates will shown to the content editor.
    Example use: includetemplatesfordisplay=Item 1
  • IncludeTemplatesForSelection
    A comma separated list of template names (no IDs). Items are visible in the tree and can be selected.
    Example use: includetemplatesforselection=Item 1 Template

I'd imagine either IncludeItemsForDisplay or IncludeTemplatesForDisplay are going to be the most useful (assuming Item 1 has a specific template).

1
  • IncludeItemsForDisplay will not work as Items are getting created by Content Authors and there can be any number of Items with different names. Item 1 does has a specific template, but it's ancestors template may differ. So for IncludeTemplatesForDisplay to work, I will have to mention all the templates which consist of Item 1( this is not possible as Authors can create content inside any template). Also, if we add Folder Template to IncludeTemplatesForDisplay, then Folder 4 will be displayed in the above example even though it does not have Item 1 as a child.
    – Shaurya
    Commented Oct 15, 2018 at 13:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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