Dropdown
Class to create custom dropdown menus, backed by HTML <select> objects.
Constructor Summary
Public Constructor | ||
public |
constructor(selectElement: Element) Constructs a Dropdown object. |
Member Summary
Public Members | ||
public |
container: * |
|
public |
display: * |
|
public |
|
|
public |
menu: * |
|
public |
optionlist: * |
|
public |
|
|
public |
|
|
public get |
Returns the value of the selected option. |
Method Summary
Public Methods | ||
public |
Creates a dropdown menu by appending HTML as a sibling of the select element. |
|
public |
Display the selected dropdown option by copying the content to the dropdown display area. |
|
public |
Returns an HTML string containing all the options for the dropdown menu. |
|
public |
hideMenu() Hide the dropdown menu. |
|
public |
Initialize all event listeners for the dropdown menu. |
|
public |
selectOption(optionElement: Element) Selects an option in the dropdown menu and updates the display. |
|
public |
showMenu() Show the dropdown menu. |
|
public |
Toggle the display of the dropdown menu. |
|
public |
Update all the displayed dropdown options using their respective init() functions in the "optionContent" field. |
|
public |
Update the status of the options and display the selected option. |
Public Constructors
Public Members
public container: * source
public display: * source
public menu: * source
public optionlist: * source
public selectElement: * source
public selectedOption: * source
Public Methods
public createDropdown() source
Creates a dropdown menu by appending HTML as a sibling of the select element.
public displaySelectedOption() source
Display the selected dropdown option by copying the content to the dropdown display area. If the content includes a canvas, the content of the canvas will be copied as well.
public getOptionsHtml(): string source
Returns an HTML string containing all the options for the dropdown menu.
public selectOption(optionElement: Element) source
Selects an option in the dropdown menu and updates the display.
Params:
Name | Type | Attribute | Description |
optionElement | Element | The option that was selected. |
public updateOptionContent() source
Update all the displayed dropdown options using their respective init() functions in the "optionContent" field.
public updateOptions() source
Update the status of the options and display the selected option. This is called when the options in the <select> element change.