Class MultiSelectListView
public sealed class MultiSelectListView : AbstractView
Inherited Members
Namespace: HomeSeer.Jui.Views
Assembly: PluginSdk.dll
A selection list allows a user to pick multiple values from a predefined collection.
Constructors
View SourceMultiSelectListView(String, String, List<String>, List<String>, EMultiSelectListType, List<Int32>)
Create a new instance of a multi select list with the default, drop down style, an ID, Name, and the specified list of options and keys
Declaration
[JsonConstructor]
public MultiSelectListView(string id, string name, List<string> options, List<string> optionKeys, EMultiSelectListType style = EMultiSelectListType.DropDown, List<int> selection = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | id | The unique ID for this View |
| System.String | name | The name of the view |
| System.Collections.Generic.List<System.String> | options | The list of options |
| System.Collections.Generic.List<System.String> | optionKeys | The list of keys corresponding to the list of options |
| EMultiSelectListType | style | The display style of the select list. DEFAULT: drop down |
| System.Collections.Generic.List<System.Int32> | selection | The list of indexes of the currently selected options in the list. DEFAULT: null |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | Thrown if multi select list is create with an invalid list of options or option keys |
| System.ArgumentOutOfRangeException | Thrown if multi select list is created with invalid indexes for the currently selected options |
MultiSelectListView(String, String, List<String>, List<String>, EMultiSelectListType, List<String>)
Create a new instance of a multi select list with the default, drop down style, an ID, Name, and the specified list of options and keys
Declaration
public MultiSelectListView(string id, string name, List<string> options, List<string> optionKeys, EMultiSelectListType style = EMultiSelectListType.DropDown, List<string> selectedKeys = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | id | The unique ID for this View |
| System.String | name | The name of the view |
| System.Collections.Generic.List<System.String> | options | The list of options |
| System.Collections.Generic.List<System.String> | optionKeys | The list of keys corresponding to the list of options |
| EMultiSelectListType | style | The display style of the select list. DEFAULT: drop down |
| System.Collections.Generic.List<System.String> | selectedKeys | The list of selected option keys |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | Thrown if multi select list is create with an invalid list of options or option keys |
Fields
View Source_selection
Declaration
List<int> _selection
Field Value
| Type | Description |
|---|---|
| System.Collections.Generic.List<System.Int32> |
Properties
View SourceDefaultSelectionText
The text displayed when Selection equals null or an emptyl List. If this property is null or empty, "Select options" is displayed.
Declaration
[JsonProperty("default_selection_text")]
public string DefaultSelectionText { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
OptionKeys
A list of keys that corresponds to the Options list.
Declaration
[JsonProperty("keys")]
public List<string> OptionKeys { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.List<System.String> |
Options
A list of options that the user can select from
Declaration
[JsonProperty("options")]
public List<string> Options { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.List<System.String> |
Selection
The indexes of the currently selected options in the list. This is the value for this view.
Declaration
[JsonProperty("selection")]
public List<int> Selection { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.List<System.Int32> |
Remarks
Set this to null or an emptyl List to display a default "Select an option" text
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentOutOfRangeException | Thrown when the selection is set to an index that does not work for the current Options |
Style
The display style for the list of options
Declaration
[JsonProperty("style")]
public EMultiSelectListType Style { get; set; }
Property Value
| Type | Description |
|---|---|
| EMultiSelectListType |
Methods
View SourceGetSelectedOptionKeys()
Get the currently selected option keys
Declaration
public List<string> GetSelectedOptionKeys()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<System.String> | The list of keys of the option at the indexes specified by Selection. |
GetSelectedOptions()
Get the currently selected options.
Declaration
public List<string> GetSelectedOptions()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<System.String> | The list of the options at the indexes specified by Selection. |
GetStringValue()
Get the value associated with this view as a string if there is one.
Declaration
public override string GetStringValue()
Returns
| Type | Description |
|---|---|
| System.String | The value stored in this view as a string or NULL if there is no value stored. |
Overrides
Remarks
Returns a comma separated list of selected option keys
ToHtml(Int32)
Get a string representation of this view converted into HTML
Declaration
public override string ToHtml(int indent = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | indent |
Returns
| Type | Description |
|---|---|
| System.String | An HTML representation of the view as a string |
Overrides
View SourceUpdate(AbstractView)
Update the view to the new state. This will change the selected options
Declaration
public override void Update(AbstractView newViewState)
Parameters
| Type | Name | Description |
|---|---|---|
| AbstractView | newViewState | The new state of the view being updated. This view's ID and Type must match the calling view exactly |
Overrides
Exceptions
| Type | Condition |
|---|---|
| ViewTypeMismatchException | Thrown when the new view's class doesn't match the calling view |
UpdateValue(String)
Update the value of the view
Declaration
public override void UpdateValue(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The new value |