5

What is the proper syntax for a 'Grouped Droplink' field? I can't seem to find proper documentation on this anywhere.

grouped droplink

Can I use this to group results from 2 sections of the content tree?

3

Short answer - Sort of, but only in a specific way.

Similar to fields such as Lookup, Multilist and TreeList, this field uses the fields's source property to retrieve a collection of items using the getLookupSourceItems pipeline. This pipeline allows for the source property to be interpreted in different ways for how to retrieve these items (e.g. a single item ID, a piped list of IDs, or a query). This pipeline is extensible so you can add other ways of interpreting the property to retrieve a list of items.

However, the field then renders each of these items from the pipeline as the group headers, and then shows the children of each of these as the selectable items under each header.

So if what you had in mind involved the selectable items as always being the children of a collection of items, then yes you could likely use this field.

If you need more flexibility, you could instead look at creating a new field type that implements similar functionality to Sitecore.Shell.Applications.ContentEditor.GroupedDroplink for how it renders the list, but it could interpret the source property differently to build the grouped collection of items.

1
  • Ah. That makes sense! I may need a custom field to have it serve my purposes but that clears it up. – Rondel Jun 20 '17 at 15:14
3

The 'Groupped Droplink' field treats every item "returned" by its source as a separate group. Then all child items of every "group" item are selected and rendered as options for each group. That is why the above approach does not work with the 'Groupped Droplink' field

The following documents on SDN provide description of the field specifics:

Content API Cookbook (chapter 4.1.8: How to access Droplink, Droptree and Grouped Droplink Fields): http://sdn.sitecore.net/Reference/Sitecore%206/Content%20API%20Cookbook.aspx

Data Definition Reference ('The Grouped Droplink Field Type' section in the chapter 4.2.3): http://sdn.sitecore.net/Reference/Sitecore%206/Data%20Definition%20Reference.aspx

Data Definition Cookbook ('Root Item' section in the chapter 2.4.2): http://sdn.sitecore.net/Reference/Sitecore%206/Data%20Definition%20Cookbook.aspx

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.