Class Dropdown

A class that represents a menu for selecting one of several values.

Hierarchy (view full)

Implements

Constructors

  • Create a new dropdown.

    The values parameter should be an object where the keys are the display text and the values are the actual values.

    Parameters

    • Optional label: string = ''

      The label text.

    • Optional values: object = {}

      The values to display in the dropdown.

    • Optional value: string = null

      The initial value of the dropdown.

    • Optional callback: Function = null

      The callback function to call when the value is changed.

    Returns Dropdown

Properties

id: string
labelRef: HTMLSpanElement
listeners: {
    [key: string]: Function[];
}

Type declaration

  • [key: string]: Function[]
ref: HTMLLabelElement
selRef: HTMLSelectElement
value: any
view: View

Methods

  • Bind a property to the dropdown.

    Parameters

    • obj: any

      The object to bind the property to.

    • prop: string

      The property to bind.

    Returns this

  • Set the callback function to call when the value is changed.

    Parameters

    • func: Function

      The callback function to call when the value is changed.

    Returns this

  • Set the label of the dropdown.

    Parameters

    • label: string

    Returns this