Orckestra / C1-CMS-Foundation

C1 CMS Foundation - .NET based, open source and a bundle of joy!
https://c1.orckestra.com/
Other
253 stars 109 forks source link

[Feature Request] Change OptionsType field in DataIdMultiSelector widget to accept IEnumerable type instead of Type type #722

Open DBailey635 opened 4 years ago

DBailey635 commented 4 years ago

Datatypes in C1 can only have one field set as the title field, so when you add a datatype to a DataIdMultiSelector widget, you'll only see that field in the list of available options. Most of the time, this is great. However, there are times when you have multiple records that have the same title field value, but are distinguished by a second or third field value.

For example, I have a list of subjects, grouped by education level (undergraduate, postgraduate, etc.). I'd like them to appear as Drama - Undergraduate, Drama - Postgraduate, but the subject title field needs to be separate from the subject level field for grouping. When I add the subject title field to the OptionsType field in DataIdMultiSelector widget, all I see is Drama, Drama in the list. There is no way to tell them apart.

Now, the Selector widget's Options field allows the input of IEnumerable types to provide the drop-down list values. This is very useful because it means that we can provide a separate customised / concatenated list of values via a function from related datatypes as a Dictionary<string, string> objects. So with my example, I see Drama - Undergraduate, Drama - Postgraduate in my selector drop-down.

The OptionsType field in DataIdMultiSelector widget only accepts the (somewhat obscure - I had to look it up) "Type" type. I'd like to request changing this to the IEnumerable types to make the widget much more flexible.

DBailey635 commented 4 years ago

Alternative would be to create a new widget that works in a similar way to DataIdMultiSelector widget, but that accepts IEnumerable type input: DataIdMultiSelectorIEnumerable.