Dropdownizer

© 2015, 2017 Leandro Silva (http://grafluxe.com)
License: MIT

Dropdownizer

Members

selectedItem:Array|Object

Gets information about the currently selected list item(s).

Methods

(static) preventNative()

Prevents native mobile dropdowns. If prevented, dropdowns on mobile/touchable devices will work as they do on desktops.

addItem(value, attributesopt, atopt):Dropdownizer

Adds list items. Note that this method properly syncs your original select elements.
Parameters
value:String
The items value.
attributes:Object = {} (optional)
Attributes to add to the list item. The supported properties are 'label', 'disabled', and 'selected'.
at:Number = NaN (optional)
The index in which to insert your new list item (defaults to the last item if not set). Use a negative number to insert from the end of the list.
Throws
Type
:RangeError
Throws if the index is out of bounds.
Returns
Type
:Dropdownizer
The Dropdownizer instance.

change(callback):Dropdownizer

Listens for change events.
Parameters
callback:function
The callback function to execute when a list item changes.
Returns
Type
:Dropdownizer
The Dropdownizer instance.
Details
Deprecated
  • This method has been renamed to 'onChange'.

destroy(resetOriginalElementopt):Dropdownizer

Removes listeners and destroys the dropdownizer instances.
Parameters
resetOriginalElement:Boolean = false (optional)
Whether to reset the original 'select' elements.
Returns
Type
:Dropdownizer
The Dropdownizer instance.

disable():Dropdownizer

Disables the dropdowns.
Returns
Type
:Dropdownizer
The Dropdownizer instance.

enable():Dropdownizer

Enables the disabled dropdowns.
Returns
Type
:Dropdownizer
The Dropdownizer instance.

onChange(callback):Dropdownizer

Listens for change events.
Parameters
callback:function
The callback function to execute when a list item changes.
Returns
Type
:Dropdownizer
The Dropdownizer instance.

onClose(callback):Dropdownizer

Listens for close events.
Parameters
callback:function
The callback function to execute when a dropdown is closed.
Returns
Type
:Dropdownizer
The Dropdownizer instance.

onOpen(callback):Dropdownizer

Listens for open events.
Parameters
callback:function
The callback function to execute when a dropdown is opened.
Returns
Type
:Dropdownizer
The Dropdownizer instance.

removeItem(at):Dropdownizer

Deletes list items. Note that this method properly syncs your original select elements.
Parameters
at:Number|String
The list items index or name. Use a negative number to select from the end of the list. Note that if using a string, letter case is ignored.
Throws
  • Type
    :Error
    Throws if your search returns multiple matches.
  • Type
    :RangeError
    Throws if the index is out of bounds.
Returns
Type
:Dropdownizer
The Dropdownizer instance.

removeListeners():Dropdownizer

Removes all listeners.
Returns
Type
:Dropdownizer
The Dropdownizer instance.

selectItem(at):Dropdownizer

Programmatically selects list items.
Parameters
at:Number|String
The list items index or name. Use a negative number to select from the end of the list. Note that if using a string, letter case is ignored.
Throws
  • Type
    :Error
    Throws if your search returns multiple matches.
  • Type
    :RangeError
    Throws if the index is out of bounds.
Returns
Type
:Dropdownizer
The Dropdownizer instance.