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.
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?