Class: DropdownSelect

FormComponents. DropdownSelect


DropdownSelect class.

The dropdown select component is used to...

Properties:
Name Type Argument Description
fieldKey string
placeholder string <optional>
callback function <optional>
changeCallback function <optional>
options array
unique string <optional>
label string | function
inputLabel string <optional>
multiple boolean <optional>
disabled boolean <optional>
debug boolean <optional>
Source:
See:
Example
<Br.Form.DropdownSelect fieldKey='Ages'
	options={['1-10', '11-20', '21-30']}
	multiple={false} placeholder='Select an Age'
	required="true" />

Methods


<static> buildSelectOptions()

Builds the selectable option list.
The label property is grabbed from this.props, else we default to label

Source:
Returns:
Type
jsx

<static> componentDidMount()

When the component mounts, an event listener is attached to the app container
to track click events, and filter them into this component's handleClick function.

Source:
Returns:
Type
null

<static> componentWillReceiveProps()

Grabs the fieldValue from this.props and sets those values as this.state.fieldValue
This is used to grab the initial value of the resource, as well as grab any updated made through
the form store, and refresh the selected bubbles with the appropriate elements.

Source:
Returns:
Type
null

<static> componentWillUnmount()

When the component is unmounted, the app container's click listener is removed

Source:
Returns:
Type
null

<static> displaySelected()

Builds a selected bubble for each selected option

Source:
Returns:
Type
jsx

<static> dropdownClasses()

Sets the classes for the dropdown

Source:
Returns:
Type
object

<static> dropdownContainerClasses()

Sets the classes for the dropdown container

Source:
Returns:
Type
object

<static> handleAction(action, resource, event)

Handles events and fires the correct action based off the event.

Parameters:
Name Type Description
action string

The action that is being passed from the event

resource *

The resource that the action will act on.

event event

The event that triggered the action.

Source:
Returns:
Type
null

<static> handleClick(event)

A click listener attached to the app container.

Any time there's a click, it checks to see if there's an open dropdown,
and if the click occurred outside of the open dropwn.

If both of these conditions are true, the dropdown is closed.

Parameters:
Name Type Description
event event

The window's click event

Source:
Returns:
Type
null

<static> headerClasses()

Sets the classes for the header

Source:
Returns:
Type
object

<static> removeOption(index)

Removes the clicked item from the selected list, and updates state

Parameters:
Name Type Description
index number

The index in the selected array of the item we're removing

Source:
Returns:
Type
null

<static> render()

Renders the Dropdown to the page

Source:
Returns:
Type
jsx

<static> setSelected(option)

After clicks, handles updating the selected array in this.state

If we're allowing multiple selections, it pushes the selection to the array,
then checks to make sure that all values are unqiue before setting state.

If we're not allowing multiple selections, it simply swaps the selections.

Parameters:
Name Type Description
option *

The selected value in the dropdown

Source:
Returns:
Type
null

<static> toggleDropdown()

Toggles the visibility of the dropdown by setting 'expandDropdown' in state.
If the dropdown has no content, we don't try to open it up

Source:
Returns:
Type
null