dijit/_HasDropDown (version 1.10)

dijit/_FocusMixin

Summary

Mixin for widgets that need drop down ability.

See the dijit/_HasDropDown reference documentation for more information.

Property Summary

  • _aroundNodeThe node to display the popup around.
  • _arrowWrapperNodeWill set CSS class dijitUpArrow, dijitDownArrow, dijitRightArrow etc. on this node depending on where the drop down is set to be positioned.
  • _buttonNodeThe button/icon/node to click to display the drop down.
  • _focusManager
  • _popupStateNodeThe node to set the aria-expanded class on.
  • _stopClickEventsWhen set to false, the click events will not be stopped, in case you want to use them in your subclass
  • autoWidthSet to true to make the drop down at least as wide as this widget.
  • dropDownThe widget to display as a popup.
  • dropDownPositionThis variable controls the position of the drop down.
  • forceWidthSet to true to make the drop down exactly as wide as this widget.
  • maxHeightThe max height for our dropdown.

Method Summary

  • buildRendering()
  • closeDropDown(focus) Closes the drop down on this widget
  • destroy()
  • isLoaded() Returns true if the dropdown exists and it's data is loaded.
  • loadAndOpenDropDown() Creates the drop down if it doesn't exist, loads the data if there's an href and it hasn't been loaded yet, and then opens the drop down.
  • loadDropDown(loadCallback) Creates the drop down if it doesn't exist, loads the data if there's an href and it hasn't been loaded yet, and then calls the given callback.
  • openDropDown() Opens the dropdown for this widget.
  • postCreate() set up nodes and connect our mouse and keyboard events
  • toggleDropDown() Callback when the user presses the down arrow button or presses the down arrow key to open/close the drop down.

Event Summary

  • _onBlur() Called magically when focus has shifted away from this widget and it's dropdown
  • _onDropDownClick(e)
  • _onDropDownMouseDown(e) Callback when the user mousedown/touchstart on the arrow icon.
  • _onDropDownMouseUp(e) Callback on mouseup/touchend after mousedown/touchstart on the arrow icon.
  • _onKey(e) Callback when the user presses a key while focused on the button node
  • _onKeyUp()

Properties

_aroundNode
Defined by: dijit/_HasDropDown

The node to display the popup around. Can be set via a data-dojo-attach-point assignment. If missing, then domNode will be used.

_arrowWrapperNode
Defined by: dijit/_HasDropDown

Will set CSS class dijitUpArrow, dijitDownArrow, dijitRightArrow etc. on this node depending on where the drop down is set to be positioned. Can be set via a data-dojo-attach-point assignment. If missing, then _buttonNode will be used.

_buttonNode
Defined by: dijit/_HasDropDown

The button/icon/node to click to display the drop down. Can be set via a data-dojo-attach-point assignment. If missing, then either focusNode or domNode (if focusNode is also missing) will be used.

_focusManager
Defined by: dijit/_FocusMixin
_popupStateNode
Defined by: dijit/_HasDropDown

The node to set the aria-expanded class on. Also sets popupActive class but that will be removed in 2.0. Can be set via a data-dojo-attach-point assignment. If missing, then focusNode or _buttonNode (if focusNode is missing) will be used.

_stopClickEvents
Defined by: dijit/_HasDropDown

When set to false, the click events will not be stopped, in case you want to use them in your subclass

autoWidth
Defined by: dijit/_HasDropDown

Set to true to make the drop down at least as wide as this widget. Set to false if the drop down should just be its default width.

dropDown
Defined by: dijit/_HasDropDown

The widget to display as a popup. This widget must be defined before the startup function is called.

dropDownPosition
Defined by: dijit/_HasDropDown

This variable controls the position of the drop down. It's an array of strings with the following values:

  • before: places drop down to the left of the target node/widget, or to the right in the case of RTL scripts like Hebrew and Arabic
  • after: places drop down to the right of the target node/widget, or to the left in the case of RTL scripts like Hebrew and Arabic
  • above: drop down goes above target node
  • below: drop down goes below target node

The list is positions is tried, in order, until a position is found where the drop down fits within the viewport.

forceWidth
Defined by: dijit/_HasDropDown

Set to true to make the drop down exactly as wide as this widget. Overrides autoWidth.

maxHeight
Defined by: dijit/_HasDropDown

The max height for our dropdown. Any dropdown taller than this will have scrollbars. Set to 0 for no max height, or -1 to limit height to available space in viewport

Methods

buildRendering()
Defined by dijit/_HasDropDown
closeDropDown(focus)
Defined by dijit/_HasDropDown

Closes the drop down on this widget

Parameter Type Description
focus Boolean

If true, refocuses the button widget

destroy()
Defined by dijit/_HasDropDown
isLoaded()
Defined by dijit/_HasDropDown

Returns true if the dropdown exists and it's data is loaded. This can be overridden in order to force a call to loadDropDown().

Returns:boolean
loadAndOpenDropDown()
Defined by dijit/_HasDropDown

Creates the drop down if it doesn't exist, loads the data if there's an href and it hasn't been loaded yet, and then opens the drop down. This is basically a callback when the user presses the down arrow button to open the drop down.

Returns:Deferred | instance

Deferred for the drop down widget that fires when drop down is created and loaded

loadDropDown(loadCallback)
Defined by dijit/_HasDropDown

Creates the drop down if it doesn't exist, loads the data if there's an href and it hasn't been loaded yet, and then calls the given callback.

Parameter Type Description
loadCallback Function
openDropDown()
Defined by dijit/_HasDropDown

Opens the dropdown for this widget. To be called only when this.dropDown has been created and is ready to display (ie, it's data is loaded).

Returns:any | undefined

return value of dijit/popup.open()

postCreate()
Defined by dijit/_HasDropDown

set up nodes and connect our mouse and keyboard events

toggleDropDown()
Defined by dijit/_HasDropDown

Callback when the user presses the down arrow button or presses the down arrow key to open/close the drop down. Toggle the drop-down widget; if it is up, close it, if not, open it

Events

_onBlur()
Defined by: dijit/_HasDropDown

Called magically when focus has shifted away from this widget and it's dropdown

_onDropDownClick(e)
Defined by: dijit/_HasDropDown
Parameter Type Description
e Event
_onDropDownMouseDown(e)
Defined by: dijit/_HasDropDown

Callback when the user mousedown/touchstart on the arrow icon.

Parameter Type Description
e Event
_onDropDownMouseUp(e)
Defined by: dijit/_HasDropDown

Callback on mouseup/touchend after mousedown/touchstart on the arrow icon. Note that this function is called regardless of what node the event occurred on (but only after a mousedown/touchstart on the arrow).

If the drop down is a simple menu and the cursor is over the menu, we execute it, otherwise, we focus our drop down widget. If the event is missing, then we are not a mouseup event.

This is useful for the common mouse movement pattern with native browser <select> nodes:

  1. mouse down on the select node (probably on the arrow)
  2. move mouse to a menu item while holding down the mouse button
  3. mouse up. this selects the menu item as though the user had clicked it.
Parameter Type Description
e Event
Optional
_onKey(e)
Defined by: dijit/_HasDropDown

Callback when the user presses a key while focused on the button node

Parameter Type Description
e Event
_onKeyUp()
Defined by: dijit/_HasDropDown
Error in the documentation? Can’t find what you are looking for? Let us know!