2

I have a treelist that I'm pointing at a folder for items, which works fine, but when I attach some kind of filtering clause, like /*[@@tid='{ID}'] it just defaults to the root of the sitecore content tree - i.e. it seems to just view the whole source as invalid and regards it as blank. I've seen stuff around creating custom treelist controls, but trying to avoid having to do that...

2

A treelist source can be set (and filtered) with a query. More info can be found here: https://getfishtank.ca/blog/treelist-data-source-hidden-functionality

This way you can include/exclude items or templates for display and/or selection. It is important to understand the difference between those. To be able to select the desired items, the tree needs to be able to display all parents to the desired item. So your displayed items is usually always more than the selection items. With the selection, you can determine which items from the displayed ones can be actually selected.

I guess you will need at least something like this:

datasource=/sitecore/content/.../folder&includetemplatesforselection=templatename

based on:

IncludeTemplatesForSelection : A comma separated list of template names (no ids). Items are visible in the tree and can be selected.

includetemplatesforselection=Item Name

| improve this answer | |
  • I've tried this but it doesn't work. I'm wondering if this is due to the field being a rendering parameter vs. a regular item field? – Levi Wallach Mar 19 '19 at 14:49
  • Just tested this (on a 9.0.2) in an rendering parameter template and works perfectly (using datasource and includetemplatesforselection) - edit the question and add the source you are using – Gatogordo Mar 19 '19 at 16:07
  • Seems like I also needed the &IncludeItemsForDisplay in order to specify the specific items, in addition to the &includetemplatesforselection=templatename. Now that I have both I'm able to filter properly, thanks for the help. – Levi Wallach Mar 20 '19 at 0:06

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.