Search Results for

    Show / Hide Table of Contents

    Class SelectListView

    • C#
    • Visual Basic
    public sealed class SelectListView : AbstractView
    Public NotInheritable Class SelectListView
        Inherits AbstractView
    Inheritance
    System.Object
    AbstractView
    SelectListView
    Inherited Members
    AbstractView.Id
    AbstractView.Name
    AbstractView.Type
    AbstractView.HtmlIndent
    AbstractView.NonAllowedCharactersForId
    AbstractView.GetIndentStringFromNumber(Int32)
    AbstractView.IdContainsNonAllowedCharacters()
    AbstractView.ShallowCopy()
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: HomeSeer.Jui.Views
    Assembly: PluginSdk.dll


    A selection list allows a user to pick a value from a predefined collection.


    Constructors

    View Source

    SelectListView(String, String, List<String>, ESelectListType, Int32)

    Create a new instance of a select list with the default, drop down style, an ID, Name, and the specified list of options

    Declaration
    • C#
    • Visual Basic
    [JsonConstructor]
    public SelectListView(string id, string name, List<string> options, ESelectListType style = ESelectListType.DropDown, int selection = -1)
    <JsonConstructor>
    Public Sub New(id As String, name As String, options As List(Of String), style As ESelectListType = ESelectListType.DropDown, selection As Integer = -1)
    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

    ESelectListType style

    The display style of the select list. DEFAULT: drop down

    System.Int32 selection

    The index of the currently selected option in the list. DEFAULT: 0

    Exceptions
    Type Condition
    System.ArgumentNullException

    Thrown if select list is create with an invalid list of options

    System.ArgumentOutOfRangeException

    Thrown if select list is created with an invalid index for the currently selected option

    View Source

    SelectListView(String, String, List<String>, List<String>, ESelectListType, Int32)

    Create a new instance of a select list with the default, drop down style, an ID, Name, and the specified list of options and keys

    Declaration
    • C#
    • Visual Basic
    public SelectListView(string id, string name, List<string> options, List<string> optionKeys, ESelectListType style = ESelectListType.DropDown, int selection = -1)
    Public Sub New(id As String, name As String, options As List(Of String), optionKeys As List(Of String), style As ESelectListType = ESelectListType.DropDown, selection As Integer = -1)
    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

    ESelectListType style

    The display style of the select list. DEFAULT: drop down

    System.Int32 selection

    The index of the currently selected option in the list. DEFAULT: 0

    Exceptions
    Type Condition
    System.ArgumentNullException

    Thrown if select list is create with an invalid list of options

    System.ArgumentOutOfRangeException

    Thrown if select list is created with an invalid index for the currently selected option

    Fields

    View Source

    _selection

    Declaration
    • C#
    • Visual Basic
    int _selection
    _selection As Integer
    Field Value
    Type Description
    System.Int32

    Properties

    View Source

    DefaultSelectionText

    The text displayed when Selection equals -1. If this property is null or empty, "Select an option" is displayed.

    Declaration
    • C#
    • Visual Basic
    [JsonProperty("default_selection_text")]
    public string DefaultSelectionText { get; set; }
    <JsonProperty("default_selection_text")>
    Public Property DefaultSelectionText As String
    Property Value
    Type Description
    System.String
    Remarks

    This property is not used when Style is RadioList

    View Source

    OptionKeys

    A list of keys that corresponds to the Options list.

    For internal use by a plugin. This is not displayed or used in any fashion otherwise.

    Declaration
    • C#
    • Visual Basic
    [JsonProperty("keys")]
    public List<string> OptionKeys { get; }
    <JsonProperty("keys")>
    Public ReadOnly Property OptionKeys As List(Of String)
    Property Value
    Type Description
    System.Collections.Generic.List<System.String>
    View Source

    Options

    A list of options that the user can select from

    Declaration
    • C#
    • Visual Basic
    [JsonProperty("options")]
    public List<string> Options { get; }
    <JsonProperty("options")>
    Public ReadOnly Property Options As List(Of String)
    Property Value
    Type Description
    System.Collections.Generic.List<System.String>
    View Source

    Selection

    The index of the currently selected option in the list. This is the value for this view.

    Declaration
    • C#
    • Visual Basic
    [JsonProperty("selection")]
    public int Selection { get; set; }
    <JsonProperty("selection")>
    Public Property Selection As Integer
    Property Value
    Type Description
    System.Int32
    Remarks

    Set this to -1 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

    View Source

    Style

    The display style for the list of options

    Declaration
    • C#
    • Visual Basic
    [JsonProperty("style")]
    public ESelectListType Style { get; set; }
    <JsonProperty("style")>
    Public Property Style As ESelectListType
    Property Value
    Type Description
    ESelectListType
    View Source

    UseOptionKeyAsSelectionValue

    When this property is true, GetStringValue() returns the selected option key instead of the selected option index, and UpdateValue(String) expects an option key as parameter instead of an option index.

    Declaration
    • C#
    • Visual Basic
    [JsonProperty("use_option_key_as_selection_value")]
    public bool UseOptionKeyAsSelectionValue { get; set; }
    <JsonProperty("use_option_key_as_selection_value")>
    Public Property UseOptionKeyAsSelectionValue As Boolean
    Property Value
    Type Description
    System.Boolean

    Methods

    View Source

    GetSelectedOption()

    Get the currently selected option text.

    Declaration
    • C#
    • Visual Basic
    public string GetSelectedOption()
    Public Function GetSelectedOption As String
    Returns
    Type Description
    System.String

    The text of the option at the index specified by Selection.

    View Source

    GetSelectedOptionKey()

    Get the currently selected option key

    Declaration
    • C#
    • Visual Basic
    public string GetSelectedOptionKey()
    Public Function GetSelectedOptionKey As String
    Returns
    Type Description
    System.String

    The key of the option at the index specified by Selection.

    View Source

    GetStringValue()

    Get the value associated with this view as a string if there is one.

    Declaration
    • C#
    • Visual Basic
    public override string GetStringValue()
    Public Overrides Function GetStringValue As String
    Returns
    Type Description
    System.String

    The value stored in this view as a string or NULL if there is no value stored.

    Overrides
    AbstractView.GetStringValue()
    Remarks

    Returns the selected option key if UseOptionKeyAsSelectionValue is true, else returns the selected index as a string

    View Source

    ToHtml(Int32)

    Get a string representation of this view converted into HTML

    Declaration
    • C#
    • Visual Basic
    public override string ToHtml(int indent = 0)
    Public Overrides Function ToHtml(indent As Integer = 0) As String
    Parameters
    Type Name Description
    System.Int32 indent
    Returns
    Type Description
    System.String

    An HTML representation of the view as a string

    Overrides
    AbstractView.ToHtml(Int32)
    View Source

    Update(AbstractView)

    Update the view to the new state. This will change the selected option

    Declaration
    • C#
    • Visual Basic
    public override void Update(AbstractView newViewState)
    Public Overrides Sub Update(newViewState As AbstractView)
    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
    AbstractView.Update(AbstractView)
    Exceptions
    Type Condition
    ViewTypeMismatchException

    Thrown when the new view's class doesn't match the calling view

    View Source

    UpdateValue(String)

    Update the value of the view

    Declaration
    • C#
    • Visual Basic
    public override void UpdateValue(string value)
    Public Overrides Sub UpdateValue(value As String)
    Parameters
    Type Name Description
    System.String value

    The new value

    Overrides
    AbstractView.UpdateValue(String)
    Exceptions
    Type Condition
    System.FormatException

    Thrown when the value is not in the correct format

    • View Source
    In This Article
    Back to top HomeSeer Technologies