Jump to content

Help on plugin option decorated with EditMultilSelect


Go to solution Solved by softworkz,

Recommended Posts

Posted

Hello,

I derived my plugin option class from EditableOptionsBase. Any enum property decorated by this attribute EditMultilSelect is rendered as a multi-select drop-down list. My intention is to leverage this UI control for user to multi-select media libraries.

The help I need is that -

  1. Besides enum, what other types are supported by EditMultilSelect?
  2. Even if it allows multi-selection, it seems only one value can be saved. Is there a way to save all the selected values?

Thanks!

@softworkz

  • Solution
Posted
18 hours ago, sjtuross said:

EditMultilSelect is rendered as a multi-select drop-down list.

This is a design decision made by Luke. My opinion about that is two-fold:

  • I think it's good to have multi-select drop-downs, because in certain cases this is a better choice
  • But I dislike that it is forced upon all multi-selection controls without being able to show a select list directly, because there are other cases where this is a much better choice 

There are two way to work around this shortcoming:

1. Multiselect without checkboxes

You can see this in the "Plugin UI Demo" plugin:

image.png.3a6e3e7e8809b23c4dc3a4154747cb7c.png

You can achieve this by adding the Emby SDK Reference: EditMultilineAttribute to the property. This actually SHOULD turn the multi-select dropdown into a plain multi-select with checkboxes, but as long as the underlying Emby UI doesn't support that, it goes a sideway which works but without checkboxes and users need to use SHIFT-CLICK and CTRL-CLICK to select multiple items.

This attribute also turns a single-select dropdown into a single-select listbox.

 

2. Grid Control

This is what is being used for example in the Transcoding Test plugin for the wizard selections. It's undocumented, but I might be able to provide a sample for using it.

 

image.png.1902ba779087d45dccdd2695d404f510.png

 

18 hours ago, sjtuross said:

The help I need is that -

  1. Besides enum, what other types are supported by EditMultilSelect?
  2. Even if it allows multi-selection, it seems only one value can be saved. Is there a way to save all the selected values?

An Emby SDK Reference: EditMultilSelectAttribute, should be applied to a string property with the value being a comma-separated list of item values.

The items source items must be another property (Browsable-False) which carries an IEnumerable of Emby SDK Reference: EditorSelectOption (defining the values and display strings). Finally, you apply this list to the multi-select property with the Emby SDK Reference: SelectItemsSourceAttribute

You can find examples for this in the file SelectionUI.cs in the Plugin UI Demo example.

Hope this helps,
sw

  • Like 1
Posted

This is extremely helpful. I finally picked the MultiEnumSelect example in SelectionUI.cs and got my library multi-selection drop-down implemented. It looks pretty cool. Thank you!!

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...