Class: FallDown

FallDown

new FallDown (options)

Name Type Description
options object
Name Type Default Description
element HTMLElement | string optional

use preexisting element for FallDown with optional data in attributes (provide either options.element or options.parent)

parent HTMLElement optional

use thsi parent to create the FallDown (provide either options.element or options.parent)

options Array.<string> | Array.<FallDownElement> optional

list of values for FallDown box

separatorOptions string "," optional

separator used to split attribute data-options from options.element

selected string | Array.<string> | Array.<FallDownElement> | FallDownElement '' optional

default value (may also be in the form of "item1,item2,item3" where ","=options.separatorOptions)

label string optional

label for FallDown box

size string optional

set this to force the editbox to have a certain size regardless of content--this size does not include the arrow size, if any (e.g., '5rem')

minSize string longest optional

longest=size to largest option; otherwise use this as minWidth (e.g., '5rem')

allowEdit boolean optional

can type entry

multipleName string optional

when set and more than 1 item is selected then text changes to "n items" where n is the number selected and items=multipleName

multipleSeparator string ", " optional

when showing multiple options on the selector, use this to separate the options

arrow object | boolean true optional

change open and close arrows; set to false to remove

Name Type Default Description
up string &#9652; optional
down string &#9662; optional
addCSS boolean optional

append styles directly to DOM instead of using stylesheet

addCSSClassName boolean falldown optional

change class names of added CSS styles (useful if you want multiple falldown boxes on same page with different styles)

styles object optional

changes default styles if options.addCSS=true

Name Type Description
main object optional
label object optional
selection object optional
selected object optional
arrow object optional
box object optional
select object optional
option object optional
cursor object optional
focus object optional
classNames object optional

change default class names of elements; don't use if options.addCSS=true

Name Type Default Description
main string falldown-main optional
label string falldown-label optional
selection string falldown-selection optional
selected string falldown-selected optional
arrow string falldown-arrow optional
box string falldown-box optional
select string falldown-select optional
option string falldown-option optional
cursor string falldown-cursor optional
focus string falldown-focus optional
Fires:
  • event:select

Members

falldown Array.<FallDownElement>

list of items in falldown box

showing boolean

Whether dropdown box is showing

value

returns current value (or array of values)

Methods

FallDown.load (className) static

load falldown on all elements with the proper className

Name Type Default Description
className string falldown

type convert

clear ()

clear all selections

close ()

close falldown box

force (input)

force selection of options based on value (clearing the remaining options)

Name Type Description
input *

or array of values to select

getIndex ()

get index (or list of indices) for selected value(s)

Returns:
(number|number[])

open ()

open falldown box

remove (index)

remove selected option

Name Type Description
index number

select (index)

select option by index

Name Type Description
index number

selectByHTML (name)

select option by HTML

Name Type Description
name string

toggle ()

toggle the falldown box open or closed

Type Definitions

FallDownElement Object

Properties:
Name Type Description
value *
html string

to display

Events

fires when the selection of the falldown changes

Type:
  • object
Properties:
Name Type Description
changed FallDownElement
value *

array of values (for option.multiple) or value of selected item

falldown FallDown

FallDown element