Class: ui/Dropdown

ui/Dropdown

new ui/Dropdown(items)

Dropdown component class.
Parameters:
Name Type Description
items Array.<Object> Item list
Properties
Name Type Description
title string Title of an item
value string | number Value of an item
type string Type of an item
Implements:
Source:

Extends

Members

ref :Object

Instance reference.
Type:
  • Object
Inherited From:
Source:

Methods

add(…element) → {Object}

Adds given element as a child.
Parameters:
Name Type Attributes Description
element ui/Element <repeatable>
Child element.
Inherited From:
Source:
Returns:
Instance reference.
Type
Object

addAfter(element, targetElement) → {Object}

Adds given element as a child after target element.
Parameters:
Name Type Description
element ui/Element Child element.
targetElement ui/Element Target element to put child near it.
Inherited From:
Source:
Returns:
Instance reference.
Type
Object

addAt(element, index) → {Object}

Adds given element as a child to a specified position.
Parameters:
Name Type Description
element ui/Element Child element.
index number Position index.
Inherited From:
Source:
Returns:
Instance reference.
Type
Object

addBefore(element, targetElement) → {Object}

Adds given element as a child before target element.
Parameters:
Name Type Description
element ui/Element Child element.
targetElement ui/Element Target element to put child near it.
Inherited From:
Source:
Returns:
Instance reference.
Type
Object

addClass(newClasses) → {Object}

Adds css classes.
Parameters:
Name Type Description
newClasses string Css class name or list separated with space.
Inherited From:
Source:
Returns:
Instance reference.
Type
Object

addNear(element, targetElement, nextToIt) → {Object}

Adds given element as a child to near target element. This is core method of addAfter and addBefore.
Parameters:
Name Type Description
element ui/Element Child element.
targetElement ui/Element Target element to put child near it.
nextToIt boolean Direction of child to put it to after or before target element.
Inherited From:
Source:
See:
Returns:
Instance reference.
Type
Object

clear() → {Object}

Clears content of element.
Inherited From:
Source:
Returns:
Instance reference.
Type
Object

clearMessage() → {Object}

Clears message under component.
Inherited From:
Source:
Returns:
Instance reference.
Type
Object

emit(action, event) → {Object}

Triggers event listener of handled action.
Parameters:
Name Type Description
action string Action name.
event Object Event object.
Inherited From:
Source:
Returns:
Instance reference.
Type
Object

emitDom(action, func) → {Object}

Triggers event listener of native dom element.
Parameters:
Name Type Description
action string Action name.
func function Listener function.
Inherited From:
Source:
Returns:
Instance reference.
Type
Object

focus() → {Object}

Focuses on button.
Inherited From:
Implements:
Source:
Returns:
Instance reference.
Type
Object

get(name) → {*}

Returns value of a property.
Parameters:
Name Type Description
name string Property name.
Inherited From:
Source:
Returns:
Value of property.
Type
*

getAttr(attr) → {string}

Returns attribute value.
Parameters:
Name Type Description
attr string Attribute name.
Inherited From:
Source:
Returns:
Attribute value.
Type
string

getChildAt(index) → {ui/Element}

Returns child at specified position.
Parameters:
Name Type Description
index number Position of child.
Inherited From:
Source:
Returns:
Child element.
Type
ui/Element

getChildren() → {Array.<ui/Element>}

Returns children.
Inherited From:
Source:
Returns:
Child elements.
Type
Array.<ui/Element>

getComponent() → {ui/Element}

Returns component element.
Inherited From:
Source:
Returns:
Component element.
Type
ui/Element

getDom() → {dom}

Returns dom object.
Inherited From:
Source:
Returns:
Element dom object.
Type
dom

getParent() → {ui/Element}

Returns parent.
Inherited From:
Source:
Returns:
Parent element.
Type
ui/Element

getStyle(key) → {string}

Returns style value.
Parameters:
Name Type Description
key string Style name.
Inherited From:
Source:
Returns:
Style value.
Type
string

getTitle() → {string}

Returns title of selected item.
Source:
Returns:
Title of selected item.
Type
string

getValue()

Returns value of component.
Implements:
Source:

handle(action) → {Object}

Make action ready to use with .on() method.
Parameters:
Name Type Description
action string Action name.
Inherited From:
Source:
Returns:
Instance reference.
Type
Object

hasClass(className) → {boolean}

Returns if element has given css class.
Parameters:
Name Type Description
className string Single css class name.
Inherited From:
Source:
Returns:
If element has given class.
Type
boolean

hide() → {Object}

Hides element.
Inherited From:
Source:
Fires:
  • ui/Element.ui/Element.event:hide
Returns:
Instance reference.
Type
Object

inc(name, value) → {Object}

Increments given number property as given value.
Parameters:
Name Type Description
name string Property name.
value number Value to increment.
Inherited From:
Source:
Returns:
Instance reference.
Type
Object

isImplementedBy(Interface) → {boolean}

To check is this an instance implemented by given interface.
Parameters:
Name Type Description
Interface Interface Interface
Inherited From:
Source:
Returns:
If it is implemented by given interface.
Type
boolean

isInstanceOf(Class) → {boolean}

To check is this an instance of given class or a class extends given class.
Parameters:
Name Type Description
Class Class Class
Inherited From:
Source:
Returns:
If it is instance of given class.
Type
boolean

isShown() → {boolean}

Returns element visibility status.
Inherited From:
Source:
Returns:
Visibility status.
Type
boolean

off(action, func) → {Object}

Removes event listener from handled action.
Parameters:
Name Type Description
action string Action name.
func function Listener function.
Inherited From:
Source:
Returns:
Instance reference.
Type
Object

offDom(action, func) → {Object}

Removes event listener from native dom element.
Parameters:
Name Type Description
action string Action name.
func function Listener function.
Inherited From:
Source:
Returns:
Instance reference.
Type
Object

on(action, func) → {Object}

Adds event listener to handled action.
Parameters:
Name Type Description
action string Action name.
func function Listener function.
Inherited From:
Source:
Returns:
Instance reference.
Type
Object

onDom(action, func) → {Object}

Adds event listener to native dom element.
Parameters:
Name Type Description
action string Action name.
func function Listener function.
Inherited From:
Source:
Returns:
Instance reference.
Type
Object

prepend(…element) → {Object}

Adds given element as a child to the begginin of content.
Parameters:
Name Type Attributes Description
element ui/Element <repeatable>
Child element.
Inherited From:
Source:
Returns:
Instance reference.
Type
Object

remove(elementopt) → {Object}

Remove child. If parameter is given, given child removes from itself, otherwise instance is removed from parent.
Parameters:
Name Type Attributes Description
element string <optional>
Child element.
Inherited From:
Source:
Returns:
Instance reference.
Type
Object

removeAttr(attr) → {Object}

Removes attribute.
Parameters:
Name Type Description
attr string Attribute name.
Inherited From:
Source:
Returns:
Instance reference.
Type
Object

removeClass(oldClasses) → {Object}

Removes css classes.
Parameters:
Name Type Description
oldClasses string Css class name or list separated with space.
Inherited From:
Source:
Returns:
Instance reference.
Type
Object

removeStyle(key) → {Object}

Removes style.
Parameters:
Name Type Description
key string Style name.
Inherited From:
Source:
Returns:
Instance reference.
Type
Object

resetValue() → {Object}

Sets value to default value.
Implements:
Source:
Returns:
Instance reference.
Type
Object

set(name, value) → {Object}

Sets a value to a property.
Parameters:
Name Type Description
name string Property name.
value * Property value.
Inherited From:
Source:
Returns:
Instance reference.
Type
Object

setAttr(attr, value) → {Object}

Sets attribute.
Parameters:
Name Type Description
attr string Attribute name.
value string Attribute value.
Inherited From:
Source:
Returns:
Instance reference.
Type
Object

setBlock(value) → {Object}

Sets container style as block.
Parameters:
Name Type Description
value boolean Value.
Inherited From:
Source:
Returns:
Instance reference.
Type
Object

setCaption(caption) → {Object}

Sets caption.
Parameters:
Name Type Description
caption string Caption of button.
Inherited From:
Source:
Returns:
Instance reference.
Type
Object

setClass(className, value) → {Object}

Adds or removes classname according to second parameter.
Parameters:
Name Type Description
className string Css class name.
value boolean If true, css class will be added, otherwise removed.
Inherited From:
Source:
Returns:
Instance reference.
Type
Object

setDefaultValue(value) → {Object}

Sets default value.
Parameters:
Name Type Description
value string | number Default value.
Implements:
Source:
Returns:
Instance reference.
Type
Object

setDisabled(value) → {Object}

Sets disabled status.
Parameters:
Name Type Description
value boolean Disabled status.
Inherited From:
Implements:
Source:
Returns:
Instance reference.
Type
Object

setIcon(name) → {Object}

Sets icon.
Parameters:
Name Type Description
name string Icon name.
Inherited From:
Source:
Returns:
Instance reference.
Type
Object

setMessage(text, theme) → {Object}

Prints message under component with given color theme.
Parameters:
Name Type Description
text string Message text.
theme string Color theme of message.
Inherited From:
Source:
Returns:
Instance reference.
Type
Object

setStyle(key, valueopt) → {Object}

Sets styles.
Parameters:
Name Type Attributes Description
key string | Array Style key or key-value array.
value string <optional>
Style value. If first parameter is array, no need to pass arguments to value.
Inherited From:
Source:
Returns:
Instance reference.
Type
Object

setTheme(theme) → {Object}

Sets color theme.
Parameters:
Name Type Description
theme string Theme name.
Inherited From:
Implements:
Source:
Returns:
Instance reference.
Type
Object

setValue(value) → {Object}

Sets value.
Parameters:
Name Type Description
value string | number Value.
Implements:
Source:
Returns:
Instance reference.
Type
Object

show() → {Object}

Shows element.
Inherited From:
Source:
Fires:
  • ui/Element.ui/Element.event:show
Returns:
Instance reference.
Type
Object

toggleClass(className) → {Object}

Toggles css class.
Parameters:
Name Type Description
className string Single css class name.
Inherited From:
Source:
Returns:
Instance reference.
Type
Object

unset(name) → {Object}

Unsets / deletes a property.
Parameters:
Name Type Description
name string Property name.
Inherited From:
Source:
Returns:
Instance reference.
Type
Object

Events

ui/Dropdown:change

Change event.
Parameters:
Name Type Description
value string | number Value of selected item.
title string Title of selected item.
Source: