dijit/Tree (version 1.10)

dijit/_Widget, dijit/_KeyNavMixin, dijit/_TemplatedMixin, dijit/_CssStateMixin

Summary

This widget displays hierarchical data from a store.

Usage

var foo = new Tree(params,srcNodeRef);
dijit/_Widget
Parameter Type Description
params Object | null

Hash of initialization parameters for widget, including scalar values (like title, duration etc.) and functions, typically callbacks like onClick. The hash can contain any of the widget's properties, excluding read-only properties.

srcNodeRef DOMNode | String
Optional

If a srcNodeRef (DOM node) is specified:

  • use srcNodeRef.innerHTML as my contents
  • if this is a behavioral widget then apply behavior to that srcNodeRef
  • otherwise, replace srcNodeRef with my generated DOM tree

See the dijit/Tree reference documentation for more information.

Property Summary

  • _attachEventsList of connections associated with data-dojo-attach-event=... in the template
  • _attachPointsList of widget attribute names associated with data-dojo-attach-point=... in the template, ex: ["containerNode", "labelNode"]
  • _attrPairNames
  • _blankGifPath to a blank 1x1 image.
  • _focusManager
  • _keyNavCodesHash mapping key code (arrow keys and home/end key) to functions to handle those keys.
  • _nodePixelIndentNumber of pixels to indent tree nodes (relative to parent node).
  • _outstandingPaintOperations
  • _renderedNot normally use, but this flag can be set by the app if the server has already rendered the template, i.e. already inlining the template for the widget into the main page.
  • _searchString
  • _setClassAttr
  • _setDirAttr
  • _setIdAttr
  • _setLangAttr
  • _setTypeAttr
  • _skipNodeCache
  • _startedstartup() has completed.
  • activeTrue if mouse was pressed while over this widget, and hasn't been released yet
  • attachScopeObject to which attach points and events will be scoped.
  • attributeMapDeprecated.
  • autoExpandFully expand the tree on load.
  • baseClass
  • betweenThresholdSet to a positive value to allow drag and drop "between" nodes.
  • checkAcceptance
  • checkItemAcceptance
  • childrenAttrDeprecated.
  • childSelector
  • class
  • containerNodeDesignates where children of the source DOM node will be placed. "Children" in this case refers to both DOM nodes and widgets.
  • cssStateNodesSubclasses may define a cssStateNodes property that lists sub-nodes within the widget that need CSS classes applied on mouse hover/press and focus.
  • dirBi-directional support, as defined by the HTML DIR attribute.
  • dndParams
  • domNodeThis is our visible representation of the widget!
  • dragThresholdNumber of pixels mouse moves before it's considered the start of a drag operation
  • focusedThis widget or a widget it contains has focus, or is "active" because it was recently clicked.
  • focusedChildThe currently focused child widget, or null if there isn't one
  • hoveringTrue if cursor is over this widget
  • idA unique, opaque ID string that can be assigned by users or by the system.
  • labelDeprecated.
  • langRarely used.
  • modelInterface to read tree data, get notifications of changes to tree data, and for handling drop operations (i.e drag and drop onto the tree)
  • multiCharSearchDurationIf multiple characters are typed where each keystroke happens within multiCharSearchDuration of the previous keystroke, search for nodes matching all the keystrokes.
  • onDndCancelParameter to dndController, see dijit/tree/dndSource.onDndCancel().
  • onDndDropParameter to dndController, see dijit/tree/dndSource.onDndDrop().
  • openOnClickIf true, clicking a folder node's label will open it, rather than calling onClick()
  • openOnDblClickIf true, double-clicking a folder node's label will open it, rather than calling onDblClick()
  • ownerDocumentThe document this widget belongs to.
  • pathBackward compatible singular variant of paths.
  • PathError
  • pathsFull paths from rootNode to selected nodes expressed as array of items or array of ids.
  • persistEnables/disables use of cookies for state saving.
  • queryDeprecated.
  • searchContainerNode
  • selectedItemBackward compatible singular variant of selectedItems.
  • selectedItemsThe currently selected items in this tree.
  • showRootShould the root node be displayed, or hidden?
  • srcNodeRefpointer to original DOM node
  • storeDeprecated.
  • styleHTML style attributes as cssText string or name/value hash
  • tabIndexTab index of the container; same as HTML tabIndex attribute.
  • templatePathPath to template (HTML file) for this widget relative to dojo.baseUrl.
  • templateString
  • titleHTML title attribute.
  • tooltipWhen this widget's title attribute is used to for a tab label, accordion pane title, etc., this specifies the tooltip to appear when the mouse is hovered over that text.

Method Summary

  • __click(nodeWidget,e,doOpen,func)
  • _adjustWidths() Size container to match widest TreeNode, so that highlighting with scrolling works (#13141, #16132)
  • _applyAttributes() Step during widget creation to copy widget attributes to the DOM according to attributeMap and _setXXXAttr objects, and also to call custom _setXXXAttr() methods.
  • _attach(node,type,func) Roughly corresponding to dojo/on, this is the default function for processing a data-dojo-attach-event.
  • _attachTemplateNodes(rootNode) Iterate through the dom nodes and attach functions and nodes accordingly.
  • _attrToDom(attr,value,commands) Reflect a widget attribute (title, tabIndex, duration etc.) to the widget DOM, as specified by commands parameter.
  • _beforeFillContent()
  • _changeAttrValue(name,value) Internal helper for directly changing an attribute value.
  • _collapseNode(node) Called when the user has requested to collapse the node
  • _createTreeNode(args) creates a TreeNode
  • _cssMouseEvent(event) Handler for CSS event on this.domNode.
  • _detachTemplateNodes() Detach and clean up the attachments made in _attachtempalteNodes.
  • _escapeValue(val) Escape a value to be inserted into the template, either into an attribute value (ex: foo="${bar}") or as inner text of an element (ex: ${foo})
  • _expandNode(node) Called when the user has requested to expand the node
  • _fillContent(source) Relocate source contents to templated container node. this.containerNode must be able to receive children, or exceptions will be thrown.
  • _get(name) Helper function to get value for specified property stored by this._set(), i.e. for properties with custom setters.
  • _getAttrNames(name) Helper function for get() and set().
  • _getFirst() Returns the first child.
  • _getFirstFocusableChild() Returns first child that can be focused.
  • _getLast() Returns the last descendant.
  • _getLastFocusableChild() Returns last child that can be focused.
  • _getNext(node) Returns the next descendant, compared to "child".
  • _getNextFocusableChild(child,dir) Returns the next or previous focusable descendant, compared to "child".
  • _getNextNode(node) Get next visible node
  • _getRootOrFirstNode() Get first visible node
  • _initState() Load in which nodes should be opened automatically
  • _introspect() Collect metadata about this widget (only once per class, not once per instance): - list of attributes with custom setters, storing in this.constructor._setterAttrs - generate this.constructor._onMap, mapping names like "mousedown" to functions like onMouseDown
  • _keyboardSearch(evt,keyChar) Perform a search of the widget's options based on the user's keyboard activity
  • _keyboardSearchCompare(item,searchString) Compares the searchString to the widget's text label, returning: * -1: a high priority match and stop searching * 0: not a match * 1: a match but keep looking for a higher priority match
  • _load() Initial load of the tree.
  • _processTemplateNode(baseNode,getAttrFunc,attachFunc) Process data-dojo-attach-point and data-dojo-attach-event for given node or widget.
  • _publish(topicName,message) Publish a message for this widget/topic
  • _saveExpandedNodes()
  • _set(name,value) Helper function to set new value for specified property, and call handlers registered with watch() if the value has changed.
  • _setFocusedAttr(val)
  • _setOwnerDocumentAttr(val)
  • _setPathAttr(path) Singular variant of _setPathsAttr
  • _setPathsAttr(paths) Select the tree nodes identified by passed paths.
  • _setSelectedItemAttr(item)
  • _setSelectedItemsAttr(items) Select tree nodes related to passed items.
  • _setSelectedNodeAttr(node)
  • _setSelectedNodesAttr(nodes) Marks the specified TreeNodes as selected.
  • _setStateClass() Update the visual state of the widget by setting the css classes on this.domNode (or this.stateNode if defined) by combining this.baseClass with various suffixes that represent the current widget state(s).
  • _setStyleAttr(value) Sets the style attribute of the widget according to value, which is either a hash like {height: "5px", width: "3px"} or a plain string
  • _startPaint(p) Called at the start of an operation that will change what's displayed.
  • _state(node,expanded) Query or set expanded state for an node
  • _store2model() User specified a store&query rather than model, so create model from store/query
  • _stringRepl(tmpl) Does substitution of ${foo} type properties in template string
  • _subnodeCssMouseEvent(node,clazz,evt) Handler for hover/active mouse event on widget's subnode
  • _trackMouseState(node,clazz) Track mouse/focus events on specified node and set CSS class on that node to indicate current state.
  • _TreeNode()
  • attr(name,value) This method is deprecated, use get() or set() directly.
  • buildRendering() Construct the UI for this widget, setting this.domNode.
  • collapseAll() Collapse all nodes in the tree
  • connect(obj,event,method) Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead.
  • create(params,srcNodeRef) Kick off the life-cycle of a widget
  • defer(fcn,delay) Wrapper to setTimeout to avoid deferred functions executing after the originating widget has been destroyed.
  • destroy()
  • destroyDescendants(preserveDom) Recursively destroy the children of this widget and their descendants.
  • destroyRecursive()
  • destroyRendering(preserveDom) Destroys the DOM nodes associated with this widget.
  • disconnect(handle) Deprecated, will be removed in 2.0, use handle.remove() instead.
  • dndController() Class to use as as the dnd controller.
  • emit(type,eventObj,callbackArgs) Used by widgets to signal that a synthetic event occurred, ex: myWidget.emit("attrmodified-selectedChildWidget", {}).
  • expandAll() Expand all nodes in the tree
  • focus() Default focus() implementation: focus the previously focused child, or first child.
  • focusChild(widget,last) Focus specified child widget.
  • focusFirstChild() Focus the first focusable child in the container.
  • focusLastChild() End key pressed; go to last visible node.
  • focusNode(node) Focus on the specified node (which must be visible)
  • get(name) Get a property from a widget.
  • getChildren() Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent is this widget.
  • getDescendants() Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode.
  • getIconClass(item,opened) Overridable function to return CSS class name to display icon
  • getIconStyle(item,opened) Overridable function to return CSS styles to display icon
  • getItemChildren(parentItem,onComplete) Deprecated.
  • getLabel(item) Overridable function to get the label for a tree node (given the item)
  • getLabelClass(item,opened) Overridable function to return CSS class name to display label
  • getLabelStyle(item,opened) Overridable function to return CSS styles to display label
  • getNodesByItem(item) Returns all tree nodes that refer to an item
  • getParent() Returns the parent widget of this widget.
  • getRowClass(item,opened) Overridable function to return CSS class name to display row
  • getRowStyle(item,opened) Overridable function to return CSS styles to display row
  • getTooltip(item) Overridable function to get the tooltip for a tree node (given the item)
  • isExpandoNode(node,widget) check whether a dom node is the expandoNode for a particular TreeNode widget
  • isFocusable() Return true if this widget can currently be focused and false if not
  • isLeftToRight() Return this widget's explicit or implicit orientation (true for LTR, false for RTL)
  • itemCreator(nodes,target,source) Returns objects passed to Tree.model.newItem() based on DnD nodes dropped onto the tree.
  • mayHaveChildren(item) Deprecated.
  • on(type,func)
  • own() Track specified handles and remove/destroy them when this instance is destroyed, unless they were already removed/destroyed manually.
  • placeAt(reference,position) Place this widget somewhere in the DOM based on standard domConstruct.place() conventions.
  • postCreate()
  • postMixInProperties()
  • postscript(params,srcNodeRef) Kicks off widget instantiation.
  • resize(changeSize)
  • set(name,value) Set a property on a widget
  • setAttribute(attr,value) Deprecated.
  • startup() Processing after the DOM fragment is added to the document
  • subscribe(t,method) Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead.
  • toString() Returns a string that represents the widget.
  • uninitialize() Deprecated.
  • unsubscribe(handle) Deprecated, will be removed in 2.0, use handle.remove() instead.
  • watch(name,callback) Watches a property for changes

Event Summary

  • _onBlur() This is where widgets do processing for when they stop being active, such as changing CSS classes.
  • _onChildBlur(widget) Called when focus leaves a child widget to go to a sibling widget.
  • _onChildFocus(child) Called when a child widget gets focus, either by user clicking it, or programatically by arrow key handling code.
  • _onClick(nodeWidget,e) Translates click events into commands for the controller to process
  • _onContainerFocus(evt) Handler for when the container itself gets focus.
  • _onContainerKeydown(evt) When a key is pressed, if it's an arrow key etc. then it's handled here.
  • _onContainerKeypress(evt) When a printable key is pressed, it's handled here, searching by letter.
  • _onDblClick(nodeWidget,e) Translates double-click events into commands for the controller to process
  • _onDownArrow(evt,node) down arrow pressed; get next visible node, set focus there
  • _onExpandoClick(message) User clicked the +/- icon; expand or collapse my children.
  • _onFocus() This is where widgets do processing for when they are active, such as changing CSS classes.
  • _onItemChange(item) Processes notification of a change to an item's scalar values like label
  • _onItemChildrenChange(parent,newChildrenList) Processes notification of a change to an item's children
  • _onItemDelete(item) Processes notification of a deletion of an item.
  • _onLeftArrow(evt,node) Left arrow pressed.
  • _onMap(type) Maps on() type parameter (ex: "mousemove") to method name (ex: "onMouseMove").
  • _onNodeMouseEnter(node) Called when mouse is over a node (onmouseenter event), this is monitored by the DND code
  • _onNodeMouseLeave(node) Called when mouse leaves a node (onmouseleave event), this is monitored by the DND code
  • _onNodePress(nodeWidget,e)
  • _onRightArrow(evt,node) Right arrow pressed; go to child node
  • _onShow() Internal method called when this widget is made visible.
  • _onUpArrow(evt,node) Up arrow pressed; move to previous visible node
  • onBlur() Called when the widget stops being "active" because focus moved to something outside of it, or the user clicked somewhere outside of it, or the widget was hidden.
  • onClick(item,node,evt) Callback when a tree node is clicked
  • onClose(item,node) Callback when a node is closed
  • onDblClick(item,node,evt) Callback when a tree node is double-clicked
  • onFocus() Called when the widget becomes "active" because it or a widget inside of it either has focus, or has recently been clicked.
  • onHide() Called when another widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.
  • onKeyboardSearch(item,evt,searchString,numMatches) When a key is pressed that matches a child item, this method is called so that a widget can take appropriate action is necessary.
  • onKeyDown(event) Connect to this function to receive notifications of keys being pressed down.
  • onKeyPress(event) Connect to this function to receive notifications of printable keys being typed.
  • onKeyUp(event) Connect to this function to receive notifications of keys being released.
  • onLoad() Called when tree finishes loading and expanding.
  • onMouseDown(event) Connect to this function to receive notifications of when the mouse button is pressed down.
  • onMouseEnter(event) Connect to this function to receive notifications of when the mouse moves onto this widget.
  • onMouseLeave(event) Connect to this function to receive notifications of when the mouse moves off of this widget.
  • onMouseMove(event) Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget.
  • onMouseOut(event) Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget.
  • onMouseOver(event) Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget.
  • onMouseUp(event) Connect to this function to receive notifications of when the mouse button is released.
  • onOpen(item,node) Callback when a node is opened
  • onShow() Called when this widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.

Properties

_attachEvents
Defined by: dijit/_AttachMixin

List of connections associated with data-dojo-attach-event=... in the template

_attachPoints
Defined by: dijit/_AttachMixin

List of widget attribute names associated with data-dojo-attach-point=... in the template, ex: ["containerNode", "labelNode"]

_attrPairNames
Defined by: dijit/_WidgetBase
_blankGif
Defined by: dijit/_WidgetBase

Path to a blank 1x1 image. Used by <img> nodes in templates that really get their image via CSS background-image.

_focusManager
Defined by: dijit/_FocusMixin
_keyNavCodes
Defined by: dijit/_KeyNavMixin

Hash mapping key code (arrow keys and home/end key) to functions to handle those keys. Usually not used directly, as subclasses can instead override _onLeftArrow() etc.

_nodePixelIndent
Defined by: dijit/Tree

Number of pixels to indent tree nodes (relative to parent node). Default is 19 but can be overridden by setting CSS class dijitTreeIndent and calling resize() or startup() on tree after it's in the DOM.

_outstandingPaintOperations
Defined by: dijit/Tree
_rendered
Defined by: dijit/_TemplatedMixin

Not normally use, but this flag can be set by the app if the server has already rendered the template, i.e. already inlining the template for the widget into the main page. Reduces _TemplatedMixin to just function like _AttachMixin.

_searchString
Defined by: dijit/_KeyNavMixin
_setClassAttr
Defined by: dijit/_WidgetBase
_setDirAttr
Defined by: dijit/_WidgetBase
_setIdAttr
Defined by: dijit/_WidgetBase
_setLangAttr
Defined by: dijit/_WidgetBase
_setTypeAttr
Defined by: dijit/_WidgetBase
_skipNodeCache
Defined by: dijit/_TemplatedMixin
_started
Defined by: dijit/_WidgetBase

startup() has completed.

active
Defined by: dijit/_CssStateMixin

True if mouse was pressed while over this widget, and hasn't been released yet

attachScope
Defined by: dijit/_AttachMixin

Object to which attach points and events will be scoped. Defaults to 'this'.

attributeMap
Defined by: dijit/_WidgetBase

Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute for each XXX attribute to be mapped to the DOM.

attributeMap sets up a "binding" between attributes (aka properties) of the widget and the widget's DOM. Changes to widget attributes listed in attributeMap will be reflected into the DOM.

For example, calling set('title', 'hello') on a TitlePane will automatically cause the TitlePane's DOM to update with the new title.

attributeMap is a hash where the key is an attribute of the widget, and the value reflects a binding to a:

  • DOM node attribute

    focus: {node: "focusNode", type: "attribute"} Maps this.focus to this.focusNode.focus

  • DOM node innerHTML

    title: { node: "titleNode", type: "innerHTML" } Maps this.title to this.titleNode.innerHTML

  • DOM node innerText

    title: { node: "titleNode", type: "innerText" } Maps this.title to this.titleNode.innerText

  • DOM node CSS class

    myClass: { node: "domNode", type: "class" } Maps this.myClass to this.domNode.className

If the value is an array, then each element in the array matches one of the formats of the above list.

There are also some shorthands for backwards compatibility:

  • string --> { node: string, type: "attribute" }, for example:
1
"focusNode" ---> { node: "focusNode", type: "attribute" }
  • "" --> { node: "domNode", type: "attribute" }
autoExpand
Defined by: dijit/Tree

Fully expand the tree on load. Overrides persist.

baseClass
Defined by: dijit/Tree
betweenThreshold
Defined by: dijit/Tree

Set to a positive value to allow drag and drop "between" nodes.

If during DnD mouse is over a (target) node but less than betweenThreshold pixels from the bottom edge, dropping the the dragged node will make it the next sibling of the target node, rather than the child.

Similarly, if mouse is over a target node but less that betweenThreshold pixels from the top edge, dropping the dragged node will make it the target node's previous sibling rather than the target node's child.

checkAcceptance
Defined by: dijit/Tree
checkItemAcceptance
Defined by: dijit/Tree
childrenAttr
Defined by: dijit/Tree

Deprecated. This information should be specified in the model. One ore more attributes that holds children of a tree node

childSelector
Defined by: dijit/Tree
class
Defined by: dijit/_WidgetBase
containerNode
Defined by: dijit/_WidgetBase

Designates where children of the source DOM node will be placed. "Children" in this case refers to both DOM nodes and widgets. For example, for myWidget:

1
2
3
4
5
<div data-dojo-type=myWidget>
    <b> here's a plain DOM node
    <span data-dojo-type=subWidget>and a widget</span>
    <i> and another plain DOM node </i>
</div>

containerNode would point to:

1
2
3
<b> here's a plain DOM node
<span data-dojo-type=subWidget>and a widget</span>
<i> and another plain DOM node </i>

In templated widgets, "containerNode" is set via a data-dojo-attach-point assignment.

containerNode must be defined for any widget that accepts innerHTML (like ContentPane or BorderContainer or even Button), and conversely is null for widgets that don't, like TextBox.

cssStateNodes
Defined by: dijit/_CssStateMixin

Subclasses may define a cssStateNodes property that lists sub-nodes within the widget that need CSS classes applied on mouse hover/press and focus.

Each entry in this optional hash is a an attach-point name (like "upArrowButton") mapped to a CSS class name (like "dijitUpArrowButton"). Example:

1
2
3
4
{
    "upArrowButton": "dijitUpArrowButton",
    "downArrowButton": "dijitDownArrowButton"
}

The above will set the CSS class dijitUpArrowButton to the this.upArrowButton DOMNode when it

is hovered, etc.

dir
Defined by: dijit/_WidgetBase

Bi-directional support, as defined by the HTML DIR attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's default direction.

dndParams
Defined by: dijit/Tree
domNode
Defined by: dijit/_WidgetBase

This is our visible representation of the widget! Other DOM Nodes may by assigned to other properties, usually through the template system's data-dojo-attach-point syntax, but the domNode property is the canonical "top level" node in widget UI.

dragThreshold
Defined by: dijit/Tree

Number of pixels mouse moves before it's considered the start of a drag operation

focused
Defined by: dijit/_FocusMixin

This widget or a widget it contains has focus, or is "active" because it was recently clicked.

focusedChild
Defined by: dijit/_KeyNavMixin

The currently focused child widget, or null if there isn't one

hovering
Defined by: dijit/_CssStateMixin

True if cursor is over this widget

id
Defined by: dijit/_WidgetBase

A unique, opaque ID string that can be assigned by users or by the system. If the developer passes an ID which is known not to be unique, the specified ID is ignored and the system-generated ID is used instead.

label
Defined by: dijit/Tree

Deprecated. Use dijit/tree/ForestStoreModel directly instead. Used in conjunction with query parameter. If a query is specified (rather than a root node id), and a label is also specified, then a fake root node is created and displayed, with this label.

lang
Defined by: dijit/_WidgetBase

Rarely used. Overrides the default Dojo locale used to render this widget, as defined by the HTML LANG attribute. Value must be among the list of locales specified during by the Dojo bootstrap, formatted according to RFC 3066 (like en-us).

model
Defined by: dijit/Tree

Interface to read tree data, get notifications of changes to tree data, and for handling drop operations (i.e drag and drop onto the tree)

multiCharSearchDuration
Defined by: dijit/_KeyNavMixin

If multiple characters are typed where each keystroke happens within multiCharSearchDuration of the previous keystroke, search for nodes matching all the keystrokes.

For example, typing "ab" will search for entries starting with "ab" unless the delay between "a" and "b" is greater than multiCharSearchDuration.

onDndCancel
Defined by: dijit/Tree

Parameter to dndController, see dijit/tree/dndSource.onDndCancel(). Generally this doesn't need to be set.

onDndDrop
Defined by: dijit/Tree

Parameter to dndController, see dijit/tree/dndSource.onDndDrop(). Generally this doesn't need to be set.

openOnClick
Defined by: dijit/Tree

If true, clicking a folder node's label will open it, rather than calling onClick()

openOnDblClick
Defined by: dijit/Tree

If true, double-clicking a folder node's label will open it, rather than calling onDblClick()

ownerDocument
Defined by: dijit/_WidgetBase

The document this widget belongs to. If not specified to constructor, will default to srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global

path
Defined by: dijit/Tree

Backward compatible singular variant of paths.

PathError
Defined by: dijit/Tree
paths
Defined by: dijit/Tree

Full paths from rootNode to selected nodes expressed as array of items or array of ids. Since setting the paths may be asynchronous (because of waiting on dojo.data), set("paths", ...) returns a Promise to indicate when the set is complete.

persist
Defined by: dijit/Tree

Enables/disables use of cookies for state saving.

query
Defined by: dijit/Tree

Deprecated. User should specify query to the model directly instead. Specifies datastore query to return the root item or top items for the tree.

searchContainerNode
Defined by: dijit/_TemplatedMixin
selectedItem
Defined by: dijit/Tree

Backward compatible singular variant of selectedItems.

selectedItems
Defined by: dijit/Tree

The currently selected items in this tree. This property can only be set (via set('selectedItems', ...)) when that item is already visible in the tree. (I.e. the tree has already been expanded to show that node.) Should generally use paths attribute to set the selected items instead.

showRoot
Defined by: dijit/Tree

Should the root node be displayed, or hidden?

srcNodeRef
Defined by: dijit/_WidgetBase

pointer to original DOM node

store
Defined by: dijit/Tree

Deprecated. Use "model" parameter instead. The store to get data to display in the tree.

style
Defined by: dijit/_WidgetBase

HTML style attributes as cssText string or name/value hash

tabIndex
Defined by: dijit/_KeyNavMixin

Tab index of the container; same as HTML tabIndex attribute. Note then when user tabs into the container, focus is immediately moved to the first item in the container.

templatePath
Defined by: dijit/_TemplatedMixin

Path to template (HTML file) for this widget relative to dojo.baseUrl. Deprecated: use templateString with require([... "dojo/text!..."], ...) instead

templateString
Defined by: dijit/Tree
title
Defined by: dijit/_WidgetBase

HTML title attribute.

For form widgets this specifies a tooltip to display when hovering over the widget (just like the native HTML title attribute).

For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer, etc., it's used to specify the tab label, accordion pane title, etc. In this case it's interpreted as HTML.

tooltip
Defined by: dijit/_WidgetBase

When this widget's title attribute is used to for a tab label, accordion pane title, etc., this specifies the tooltip to appear when the mouse is hovered over that text.

Methods

__click(nodeWidget,e,doOpen,func)
Defined by dijit/Tree
Parameter Type Description
nodeWidget Object

An object with the following properties:

  • item (Item):

    the dojo.data entry this tree represents

  • isTreeNode (Boolean):

    Indicates that this is a TreeNode. Used by dijit.Tree only, should not be accessed directly.

  • label (String):

    Text of this tree node

  • _setLabelAttr
  • labelType (String):

    Specifies how to interpret the label. Can be "html" or "text".

  • isExpandable (Boolean):

    This node has children, so show the expando node (+ sign)

  • isExpanded (Boolean):

    This node is currently expanded (ie, opened)

  • state (String):

    Dynamic loading-related stuff. When an empty folder node appears, it is "NotLoaded" first, then after dojo.data query it becomes "Loading" and, finally "Loaded"

  • templateString
  • baseClass
  • cssStateNodes
  • _setTooltipAttr
  • buildRendering
  • _setIndentAttr:

    Tell this node how many levels it should be indented

  • markProcessing:

    Visually denote that tree is loading data, etc.

  • unmarkProcessing:

    Clear markup from markProcessing() call

  • _updateItemClasses:

    Set appropriate CSS classes for icon and label dom node (used to allow for item updates to change respective CSS)

  • _applyClassAndStyle:

    Set the appropriate CSS classes and styles for labels, icons and rows.

  • _updateLayout:

    Set appropriate CSS classes for this.domNode

  • _setExpando:

    Set the right image for the expando node

  • expand:

    Show my children

  • collapse:

    Collapse this node (if it's expanded)

  • indent (Integer):

    Levels from this node to the root node

  • setChildItems:

    Sets the child items of this node, removing/adding nodes from current children to match specified items[] array. Also, if this.persist == true, expands any children that were previously opened.

  • getTreePath
  • getIdentity
  • removeChild
  • makeExpandable:

    if this node wasn't already showing the expando node, turn it into one and call _setExpando()

  • setSelected:

    A Tree has a (single) currently selected node. Mark that this node is/isn't that currently selected node.

  • focus
  • onClick:

    Connect to this function to receive notifications of mouse click events.

  • onDblClick:

    Connect to this function to receive notifications of mouse double click events.

  • onKeyDown:

    Connect to this function to receive notifications of keys being pressed down.

  • onKeyPress:

    Connect to this function to receive notifications of printable keys being typed.

  • onKeyUp:

    Connect to this function to receive notifications of keys being released.

  • onMouseDown:

    Connect to this function to receive notifications of when the mouse button is pressed down.

  • onMouseMove:

    Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget.

  • onMouseOut:

    Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget.

  • onMouseOver:

    Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget.

  • onMouseLeave:

    Connect to this function to receive notifications of when the mouse moves off of this widget.

  • onMouseEnter:

    Connect to this function to receive notifications of when the mouse moves onto this widget.

  • onMouseUp:

    Connect to this function to receive notifications of when the mouse button is released.

  • postCreate
  • on
  • _setFocusedAttr
  • setAttribute:

    Deprecated. Use set() instead.

  • attr:

    This method is deprecated, use get() or set() directly.

  • getDescendants:

    Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode. This method should generally be avoided as it returns widgets declared in templates, which are supposed to be internal/hidden, but it's left here for back-compat reasons.

  • _onShow:

    Internal method called when this widget is made visible. See onShow for details.

  • onShow:

    Called when this widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.

    Also called to indicate display of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane.

  • onHide:

    Called when another widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.

    Also called to indicate hide of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane.

  • onClose:

    Called when this widget is being displayed as a popup (ex: a Calendar popped up from a DateTextBox), and it is hidden. This is called from the dijit.popup code, and should not be called directly.

    Also used as a parameter for children of dijit/layout/StackContainer or subclasses. Callback if a user tries to close the child. Child will be closed if this function returns true.

  • id (String):

    A unique, opaque ID string that can be assigned by users or by the system. If the developer passes an ID which is known not to be unique, the specified ID is ignored and the system-generated ID is used instead.

  • _setIdAttr
  • lang (String):

    Rarely used. Overrides the default Dojo locale used to render this widget, as defined by the HTML LANG attribute. Value must be among the list of locales specified during by the Dojo bootstrap, formatted according to RFC 3066 (like en-us).

  • _setLangAttr
  • dir (String):

    Bi-directional support, as defined by the HTML DIR attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's default direction.

  • _setDirAttr
  • class
  • _setClassAttr
  • _setTypeAttr
  • style (String||Object):

    HTML style attributes as cssText string or name/value hash

  • title (String):

    HTML title attribute.

    For form widgets this specifies a tooltip to display when hovering over the widget (just like the native HTML title attribute).

    For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer, etc., it's used to specify the tab label, accordion pane title, etc. In this case it's interpreted as HTML.

  • tooltip (String):

    When this widget's title attribute is used to for a tab label, accordion pane title, etc., this specifies the tooltip to appear when the mouse is hovered over that text.

  • srcNodeRef (DomNode):

    pointer to original DOM node

  • domNode (DomNode):

    This is our visible representation of the widget! Other DOM Nodes may by assigned to other properties, usually through the template system's data-dojo-attach-point syntax, but the domNode property is the canonical "top level" node in widget UI.

  • containerNode (DomNode):

    Designates where children of the source DOM node will be placed. "Children" in this case refers to both DOM nodes and widgets. For example, for myWidget:

    1
    2
    3
    4
    5
    <div data-dojo-type=myWidget>
        <b> here's a plain DOM node
        <span data-dojo-type=subWidget>and a widget</span>
        <i> and another plain DOM node </i>
    </div>

    containerNode would point to:

    1
    2
    3
    <b> here's a plain DOM node
    <span data-dojo-type=subWidget>and a widget</span>
    <i> and another plain DOM node </i>

    In templated widgets, "containerNode" is set via a data-dojo-attach-point assignment.

    containerNode must be defined for any widget that accepts innerHTML (like ContentPane or BorderContainer or even Button), and conversely is null for widgets that don't, like TextBox.

  • ownerDocument (Document?, optional):

    The document this widget belongs to. If not specified to constructor, will default to srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global

  • _setOwnerDocumentAttr
  • _started (Boolean):

    startup() has completed.

  • attributeMap (Object):

    Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute for each XXX attribute to be mapped to the DOM.

    attributeMap sets up a "binding" between attributes (aka properties) of the widget and the widget's DOM. Changes to widget attributes listed in attributeMap will be reflected into the DOM.

    For example, calling set('title', 'hello') on a TitlePane will automatically cause the TitlePane's DOM to update with the new title.

    attributeMap is a hash where the key is an attribute of the widget, and the value reflects a binding to a:

    • DOM node attribute

      focus: {node: "focusNode", type: "attribute"} Maps this.focus to this.focusNode.focus

    • DOM node innerHTML

      title: { node: "titleNode", type: "innerHTML" } Maps this.title to this.titleNode.innerHTML

    • DOM node innerText

      title: { node: "titleNode", type: "innerText" } Maps this.title to this.titleNode.innerText

    • DOM node CSS class

      myClass: { node: "domNode", type: "class" } Maps this.myClass to this.domNode.className

    If the value is an array, then each element in the array matches one of the formats of the above list.

    There are also some shorthands for backwards compatibility:

    • string --> { node: string, type: "attribute" }, for example:
    1
    "focusNode" ---> { node: "focusNode", type: "attribute" }
    • "" --> { node: "domNode", type: "attribute" }
  • _blankGif (String):

    Path to a blank 1x1 image. Used by <img> nodes in templates that really get their image via CSS background-image.

  • _introspect:

    Collect metadata about this widget (only once per class, not once per instance):

    1
    2
    - list of attributes with custom setters, storing in this.constructor._setterAttrs
    - generate this.constructor._onMap, mapping names like "mousedown" to functions like onMouseDown
  • postscript:

    Kicks off widget instantiation. See create() for details.

  • create:

    Kick off the life-cycle of a widget

  • _applyAttributes:

    Step during widget creation to copy widget attributes to the DOM according to attributeMap and _setXXXAttr objects, and also to call custom _setXXXAttr() methods.

    Skips over blank/false attribute values, unless they were explicitly specified as parameters to the widget, since those are the default anyway, and setting tabIndex="" is different than not setting tabIndex at all.

    For backwards-compatibility reasons attributeMap overrides _setXXXAttr when _setXXXAttr is a hash/string/array, but _setXXXAttr as a functions override attributeMap.

  • postMixInProperties:

    Called after the parameters to the widget have been read-in, but before the widget template is instantiated. Especially useful to set properties that are referenced in the widget template.

  • startup:

    Processing after the DOM fragment is added to the document

  • destroyRecursive:

    Destroy this widget and its descendants

  • destroy:

    Destroy this widget, but not its descendants. Descendants means widgets inside of this.containerNode. Will also destroy any resources (including widgets) registered via this.own().

    This method will also destroy internal widgets such as those created from a template, assuming those widgets exist inside of this.domNode but outside of this.containerNode.

    For 2.0 it's planned that this method will also destroy descendant widgets, so apps should not depend on the current ability to destroy a widget without destroying its descendants. Generally they should use destroyRecursive() for widgets with children.

  • destroyRendering:

    Destroys the DOM nodes associated with this widget.

  • destroyDescendants:

    Recursively destroy the children of this widget and their descendants.

  • uninitialize:

    Deprecated. Override destroy() instead to implement custom widget tear-down behavior.

  • _setStyleAttr:

    Sets the style attribute of the widget according to value, which is either a hash like {height: "5px", width: "3px"} or a plain string

  • _attrToDom:

    Reflect a widget attribute (title, tabIndex, duration etc.) to the widget DOM, as specified by commands parameter. If commands isn't specified then it's looked up from attributeMap. Note some attributes like "type" cannot be processed this way as they are not mutable.

  • get:

    Get a property from a widget.

  • set:

    Set a property on a widget

  • _attrPairNames
  • _getAttrNames:

    Helper function for get() and set(). Caches attribute name values so we don't do the string ops every time.

  • _set:

    Helper function to set new value for specified property, and call handlers registered with watch() if the value has changed.

  • _get:

    Helper function to get value for specified property stored by this._set(), i.e. for properties with custom setters. Used mainly by custom getters.

    For example, CheckBox._getValueAttr() calls this._get("value").

  • emit:

    Used by widgets to signal that a synthetic event occurred, ex:

    1
    myWidget.emit("attrmodified-selectedChildWidget", {}).

    Emits an event on this.domNode named type.toLowerCase(), based on eventObj. Also calls onType() method, if present, and returns value from that method. By default passes eventObj to callback, but will pass callbackArgs instead, if specified. Modifies eventObj by adding missing parameters (bubbles, cancelable, widget).

  • _onMap:

    Maps on() type parameter (ex: "mousemove") to method name (ex: "onMouseMove"). If type is a synthetic event like touch.press then returns undefined.

  • toString:

    Returns a string that represents the widget.

  • getChildren:

    Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent is this widget. Note that it does not return all descendants, but rather just direct children. Analogous to Node.childNodes, except containing widgets rather than DOMNodes.

    The result intentionally excludes internally created widgets (a.k.a. supporting widgets) outside of this.containerNode.

    Note that the array returned is a simple array. Application code should not assume existence of methods like forEach().

  • getParent:

    Returns the parent widget of this widget.

  • connect:

    Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead.

    Connects specified obj/event to specified method of this object and registers for disconnect() on widget destroy.

    Provide widget-specific analog to dojo.connect, except with the implicit use of this widget as the target object. Events connected with this.connect are disconnected upon destruction.

  • disconnect:

    Deprecated, will be removed in 2.0, use handle.remove() instead.

    Disconnects handle created by connect.

  • subscribe:

    Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead.

    Subscribes to the specified topic and calls the specified method of this object and registers for unsubscribe() on widget destroy.

    Provide widget-specific analog to dojo.subscribe, except with the implicit use of this widget as the target object.

  • unsubscribe:

    Deprecated, will be removed in 2.0, use handle.remove() instead.

    Unsubscribes handle created by this.subscribe. Also removes handle from this widget's list of subscriptions

  • isLeftToRight:

    Return this widget's explicit or implicit orientation (true for LTR, false for RTL)

  • isFocusable:

    Return true if this widget can currently be focused and false if not

  • placeAt:

    Place this widget somewhere in the DOM based on standard domConstruct.place() conventions.

  • defer:

    Wrapper to setTimeout to avoid deferred functions executing after the originating widget has been destroyed. Returns an object handle with a remove method (that returns null) (replaces clearTimeout).

  • _changeAttrValue:

    Internal helper for directly changing an attribute value.

  • watch:

    Watches a property for changes

  • own:

    Track specified handles and remove/destroy them when this instance is destroyed, unless they were already removed/destroyed manually.

  • focused (Boolean):

    This widget or a widget it contains has focus, or is "active" because it was recently clicked.

  • onFocus:

    Called when the widget becomes "active" because it or a widget inside of it either has focus, or has recently been clicked.

  • onBlur:

    Called when the widget stops being "active" because focus moved to something outside of it, or the user clicked somewhere outside of it, or the widget was hidden.

  • _onFocus:

    This is where widgets do processing for when they are active, such as changing CSS classes. See onFocus() for more details.

  • _onBlur:

    This is where widgets do processing for when they stop being active, such as changing CSS classes. See onBlur() for more details.

  • _focusManager
  • templatePath (String):

    Path to template (HTML file) for this widget relative to dojo.baseUrl. Deprecated: use templateString with require([... "dojo/text!..."], ...) instead

  • _skipNodeCache
  • _rendered (Boolean):

    Not normally use, but this flag can be set by the app if the server has already rendered the template, i.e. already inlining the template for the widget into the main page. Reduces _TemplatedMixin to just function like _AttachMixin.

  • searchContainerNode
  • _stringRepl:

    Does substitution of ${foo} type properties in template string

  • _escapeValue:

    Escape a value to be inserted into the template, either into an attribute value (ex: foo="${bar}") or as inner text of an element (ex: ${foo})

  • _fillContent:

    Relocate source contents to templated container node. this.containerNode must be able to receive children, or exceptions will be thrown.

  • _attachPoints (String[]):

    List of widget attribute names associated with data-dojo-attach-point=... in the template, ex: ["containerNode", "labelNode"]

  • _attachEvents (Handle[]):

    List of connections associated with data-dojo-attach-event=... in the template

  • attachScope (Object):

    Object to which attach points and events will be scoped. Defaults to 'this'.

  • _beforeFillContent
  • _attachTemplateNodes:

    Iterate through the dom nodes and attach functions and nodes accordingly.

  • _processTemplateNode:

    Process data-dojo-attach-point and data-dojo-attach-event for given node or widget. Returns true if caller should process baseNode's children too.

  • _attach:

    Roughly corresponding to dojo/on, this is the default function for processing a data-dojo-attach-event. Meant to attach to DOMNodes, not to widgets.

  • _detachTemplateNodes:

    Detach and clean up the attachments made in _attachtempalteNodes.

  • addChild:

    Makes the given widget a child of this widget.

  • hasChildren:

    Returns true if widget has child widgets, i.e. if this.containerNode contains widgets.

  • _getSiblingOfChild:

    Get the next or previous widget sibling of child

  • getIndexOfChild:

    Gets the index of the child in this container or -1 if not found

  • _getSibling:

    Returns next or previous sibling

  • getPreviousSibling:

    Returns null if this is the first child of the parent, otherwise returns the next element sibling to the "left".

  • getNextSibling:

    Returns null if this is the last child of the parent, otherwise returns the next element sibling to the "right".

  • getIndexInParent:

    Returns the index of this widget within its container parent. It returns -1 if the parent does not exist, or if the parent is not a dijit/_Container

  • hovering (Boolean):

    True if cursor is over this widget

  • active (Boolean):

    True if mouse was pressed while over this widget, and hasn't been released yet

  • _cssMouseEvent:

    Handler for CSS event on this.domNode. Sets hovering and active properties depending on mouse state, which triggers _setStateClass() to set appropriate CSS classes for this.domNode.

  • _setStateClass:

    Update the visual state of the widget by setting the css classes on this.domNode (or this.stateNode if defined) by combining this.baseClass with various suffixes that represent the current widget state(s).

  • _subnodeCssMouseEvent:

    Handler for hover/active mouse event on widget's subnode

  • _trackMouseState:

    Track mouse/focus events on specified node and set CSS class on that node to indicate current state. Usually not called directly, but via cssStateNodes attribute.

e Event
doOpen Boolean
func String
_adjustWidths()
Defined by dijit/Tree

Size container to match widest TreeNode, so that highlighting with scrolling works (#13141, #16132)

_applyAttributes()
Defined by dijit/_WidgetBase

Step during widget creation to copy widget attributes to the DOM according to attributeMap and _setXXXAttr objects, and also to call custom _setXXXAttr() methods.

Skips over blank/false attribute values, unless they were explicitly specified as parameters to the widget, since those are the default anyway, and setting tabIndex="" is different than not setting tabIndex at all.

For backwards-compatibility reasons attributeMap overrides _setXXXAttr when _setXXXAttr is a hash/string/array, but _setXXXAttr as a functions override attributeMap.

_attach(node,type,func)
Defined by dijit/_AttachMixin

Roughly corresponding to dojo/on, this is the default function for processing a data-dojo-attach-event. Meant to attach to DOMNodes, not to widgets.

Parameter Type Description
node DOMNode

The node to setup a listener on.

type String

Event name like "click".

func undefined
Returns:undefined
_attachTemplateNodes(rootNode)
Defined by dijit/_AttachMixin

Iterate through the dom nodes and attach functions and nodes accordingly.

Map widget properties and functions to the handlers specified in the dom node and it's descendants. This function iterates over all nodes and looks for these properties:

  • dojoAttachPoint/data-dojo-attach-point
  • dojoAttachEvent/data-dojo-attach-event
Parameter Type Description
rootNode DomNode

The node to search for properties. All descendants will be searched.

_attrToDom(attr,value,commands)
Defined by dijit/_WidgetBase

Reflect a widget attribute (title, tabIndex, duration etc.) to the widget DOM, as specified by commands parameter. If commands isn't specified then it's looked up from attributeMap. Note some attributes like "type" cannot be processed this way as they are not mutable.

Parameter Type Description
attr String

Name of member variable (ex: "focusNode" maps to this.focusNode) pointing to DOMNode inside the widget, or alternately pointing to a subwidget

value String
commands Object
Optional
_beforeFillContent()
Defined by dijit/_AttachMixin
_changeAttrValue(name,value)
Defined by dojo/Stateful

Internal helper for directly changing an attribute value.

Directly change the value of an attribute on an object, bypassing any accessor setter. Also handles the calling of watch and emitting events. It is designed to be used by descendant class when there are two values of attributes that are linked, but calling .set() is not appropriate.

Parameter Type Description
name String

The property to set.

value Mixed

The value to set in the property.

Returns:function

Internal helper for directly changing an attribute value.

_collapseNode(node)
Defined by dijit/Tree

Called when the user has requested to collapse the node

Parameter Type Description
node Object

An object with the following properties:

  • item (Item):

    the dojo.data entry this tree represents

  • isTreeNode (Boolean):

    Indicates that this is a TreeNode. Used by dijit.Tree only, should not be accessed directly.

  • label (String):

    Text of this tree node

  • _setLabelAttr
  • labelType (String):

    Specifies how to interpret the label. Can be "html" or "text".

  • isExpandable (Boolean):

    This node has children, so show the expando node (+ sign)

  • isExpanded (Boolean):

    This node is currently expanded (ie, opened)

  • state (String):

    Dynamic loading-related stuff. When an empty folder node appears, it is "NotLoaded" first, then after dojo.data query it becomes "Loading" and, finally "Loaded"

  • templateString
  • baseClass
  • cssStateNodes
  • _setTooltipAttr
  • buildRendering
  • _setIndentAttr:

    Tell this node how many levels it should be indented

  • markProcessing:

    Visually denote that tree is loading data, etc.

  • unmarkProcessing:

    Clear markup from markProcessing() call

  • _updateItemClasses:

    Set appropriate CSS classes for icon and label dom node (used to allow for item updates to change respective CSS)

  • _applyClassAndStyle:

    Set the appropriate CSS classes and styles for labels, icons and rows.

  • _updateLayout:

    Set appropriate CSS classes for this.domNode

  • _setExpando:

    Set the right image for the expando node

  • expand:

    Show my children

  • collapse:

    Collapse this node (if it's expanded)

  • indent (Integer):

    Levels from this node to the root node

  • setChildItems:

    Sets the child items of this node, removing/adding nodes from current children to match specified items[] array. Also, if this.persist == true, expands any children that were previously opened.

  • getTreePath
  • getIdentity
  • removeChild
  • makeExpandable:

    if this node wasn't already showing the expando node, turn it into one and call _setExpando()

  • setSelected:

    A Tree has a (single) currently selected node. Mark that this node is/isn't that currently selected node.

  • focus
  • onClick:

    Connect to this function to receive notifications of mouse click events.

  • onDblClick:

    Connect to this function to receive notifications of mouse double click events.

  • onKeyDown:

    Connect to this function to receive notifications of keys being pressed down.

  • onKeyPress:

    Connect to this function to receive notifications of printable keys being typed.

  • onKeyUp:

    Connect to this function to receive notifications of keys being released.

  • onMouseDown:

    Connect to this function to receive notifications of when the mouse button is pressed down.

  • onMouseMove:

    Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget.

  • onMouseOut:

    Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget.

  • onMouseOver:

    Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget.

  • onMouseLeave:

    Connect to this function to receive notifications of when the mouse moves off of this widget.

  • onMouseEnter:

    Connect to this function to receive notifications of when the mouse moves onto this widget.

  • onMouseUp:

    Connect to this function to receive notifications of when the mouse button is released.

  • postCreate
  • on
  • _setFocusedAttr
  • setAttribute:

    Deprecated. Use set() instead.

  • attr:

    This method is deprecated, use get() or set() directly.

  • getDescendants:

    Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode. This method should generally be avoided as it returns widgets declared in templates, which are supposed to be internal/hidden, but it's left here for back-compat reasons.

  • _onShow:

    Internal method called when this widget is made visible. See onShow for details.

  • onShow:

    Called when this widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.

    Also called to indicate display of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane.

  • onHide:

    Called when another widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.

    Also called to indicate hide of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane.

  • onClose:

    Called when this widget is being displayed as a popup (ex: a Calendar popped up from a DateTextBox), and it is hidden. This is called from the dijit.popup code, and should not be called directly.

    Also used as a parameter for children of dijit/layout/StackContainer or subclasses. Callback if a user tries to close the child. Child will be closed if this function returns true.

  • id (String):

    A unique, opaque ID string that can be assigned by users or by the system. If the developer passes an ID which is known not to be unique, the specified ID is ignored and the system-generated ID is used instead.

  • _setIdAttr
  • lang (String):

    Rarely used. Overrides the default Dojo locale used to render this widget, as defined by the HTML LANG attribute. Value must be among the list of locales specified during by the Dojo bootstrap, formatted according to RFC 3066 (like en-us).

  • _setLangAttr
  • dir (String):

    Bi-directional support, as defined by the HTML DIR attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's default direction.

  • _setDirAttr
  • class
  • _setClassAttr
  • _setTypeAttr
  • style (String||Object):

    HTML style attributes as cssText string or name/value hash

  • title (String):

    HTML title attribute.

    For form widgets this specifies a tooltip to display when hovering over the widget (just like the native HTML title attribute).

    For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer, etc., it's used to specify the tab label, accordion pane title, etc. In this case it's interpreted as HTML.

  • tooltip (String):

    When this widget's title attribute is used to for a tab label, accordion pane title, etc., this specifies the tooltip to appear when the mouse is hovered over that text.

  • srcNodeRef (DomNode):

    pointer to original DOM node

  • domNode (DomNode):

    This is our visible representation of the widget! Other DOM Nodes may by assigned to other properties, usually through the template system's data-dojo-attach-point syntax, but the domNode property is the canonical "top level" node in widget UI.

  • containerNode (DomNode):

    Designates where children of the source DOM node will be placed. "Children" in this case refers to both DOM nodes and widgets. For example, for myWidget:

    1
    2
    3
    4
    5
    <div data-dojo-type=myWidget>
        <b> here's a plain DOM node
        <span data-dojo-type=subWidget>and a widget</span>
        <i> and another plain DOM node </i>
    </div>

    containerNode would point to:

    1
    2
    3
    <b> here's a plain DOM node
    <span data-dojo-type=subWidget>and a widget</span>
    <i> and another plain DOM node </i>

    In templated widgets, "containerNode" is set via a data-dojo-attach-point assignment.

    containerNode must be defined for any widget that accepts innerHTML (like ContentPane or BorderContainer or even Button), and conversely is null for widgets that don't, like TextBox.

  • ownerDocument (Document?, optional):

    The document this widget belongs to. If not specified to constructor, will default to srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global

  • _setOwnerDocumentAttr
  • _started (Boolean):

    startup() has completed.

  • attributeMap (Object):

    Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute for each XXX attribute to be mapped to the DOM.

    attributeMap sets up a "binding" between attributes (aka properties) of the widget and the widget's DOM. Changes to widget attributes listed in attributeMap will be reflected into the DOM.

    For example, calling set('title', 'hello') on a TitlePane will automatically cause the TitlePane's DOM to update with the new title.

    attributeMap is a hash where the key is an attribute of the widget, and the value reflects a binding to a:

    • DOM node attribute

      focus: {node: "focusNode", type: "attribute"} Maps this.focus to this.focusNode.focus

    • DOM node innerHTML

      title: { node: "titleNode", type: "innerHTML" } Maps this.title to this.titleNode.innerHTML

    • DOM node innerText

      title: { node: "titleNode", type: "innerText" } Maps this.title to this.titleNode.innerText

    • DOM node CSS class

      myClass: { node: "domNode", type: "class" } Maps this.myClass to this.domNode.className

    If the value is an array, then each element in the array matches one of the formats of the above list.

    There are also some shorthands for backwards compatibility:

    • string --> { node: string, type: "attribute" }, for example:
    1
    "focusNode" ---> { node: "focusNode", type: "attribute" }
    • "" --> { node: "domNode", type: "attribute" }
  • _blankGif (String):

    Path to a blank 1x1 image. Used by <img> nodes in templates that really get their image via CSS background-image.

  • _introspect:

    Collect metadata about this widget (only once per class, not once per instance):

    1
    2
    - list of attributes with custom setters, storing in this.constructor._setterAttrs
    - generate this.constructor._onMap, mapping names like "mousedown" to functions like onMouseDown
  • postscript:

    Kicks off widget instantiation. See create() for details.

  • create:

    Kick off the life-cycle of a widget

  • _applyAttributes:

    Step during widget creation to copy widget attributes to the DOM according to attributeMap and _setXXXAttr objects, and also to call custom _setXXXAttr() methods.

    Skips over blank/false attribute values, unless they were explicitly specified as parameters to the widget, since those are the default anyway, and setting tabIndex="" is different than not setting tabIndex at all.

    For backwards-compatibility reasons attributeMap overrides _setXXXAttr when _setXXXAttr is a hash/string/array, but _setXXXAttr as a functions override attributeMap.

  • postMixInProperties:

    Called after the parameters to the widget have been read-in, but before the widget template is instantiated. Especially useful to set properties that are referenced in the widget template.

  • startup:

    Processing after the DOM fragment is added to the document

  • destroyRecursive:

    Destroy this widget and its descendants

  • destroy:

    Destroy this widget, but not its descendants. Descendants means widgets inside of this.containerNode. Will also destroy any resources (including widgets) registered via this.own().

    This method will also destroy internal widgets such as those created from a template, assuming those widgets exist inside of this.domNode but outside of this.containerNode.

    For 2.0 it's planned that this method will also destroy descendant widgets, so apps should not depend on the current ability to destroy a widget without destroying its descendants. Generally they should use destroyRecursive() for widgets with children.

  • destroyRendering:

    Destroys the DOM nodes associated with this widget.

  • destroyDescendants:

    Recursively destroy the children of this widget and their descendants.

  • uninitialize:

    Deprecated. Override destroy() instead to implement custom widget tear-down behavior.

  • _setStyleAttr:

    Sets the style attribute of the widget according to value, which is either a hash like {height: "5px", width: "3px"} or a plain string

  • _attrToDom:

    Reflect a widget attribute (title, tabIndex, duration etc.) to the widget DOM, as specified by commands parameter. If commands isn't specified then it's looked up from attributeMap. Note some attributes like "type" cannot be processed this way as they are not mutable.

  • get:

    Get a property from a widget.

  • set:

    Set a property on a widget

  • _attrPairNames
  • _getAttrNames:

    Helper function for get() and set(). Caches attribute name values so we don't do the string ops every time.

  • _set:

    Helper function to set new value for specified property, and call handlers registered with watch() if the value has changed.

  • _get:

    Helper function to get value for specified property stored by this._set(), i.e. for properties with custom setters. Used mainly by custom getters.

    For example, CheckBox._getValueAttr() calls this._get("value").

  • emit:

    Used by widgets to signal that a synthetic event occurred, ex:

    1
    myWidget.emit("attrmodified-selectedChildWidget", {}).

    Emits an event on this.domNode named type.toLowerCase(), based on eventObj. Also calls onType() method, if present, and returns value from that method. By default passes eventObj to callback, but will pass callbackArgs instead, if specified. Modifies eventObj by adding missing parameters (bubbles, cancelable, widget).

  • _onMap:

    Maps on() type parameter (ex: "mousemove") to method name (ex: "onMouseMove"). If type is a synthetic event like touch.press then returns undefined.

  • toString:

    Returns a string that represents the widget.

  • getChildren:

    Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent is this widget. Note that it does not return all descendants, but rather just direct children. Analogous to Node.childNodes, except containing widgets rather than DOMNodes.

    The result intentionally excludes internally created widgets (a.k.a. supporting widgets) outside of this.containerNode.

    Note that the array returned is a simple array. Application code should not assume existence of methods like forEach().

  • getParent:

    Returns the parent widget of this widget.

  • connect:

    Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead.

    Connects specified obj/event to specified method of this object and registers for disconnect() on widget destroy.

    Provide widget-specific analog to dojo.connect, except with the implicit use of this widget as the target object. Events connected with this.connect are disconnected upon destruction.

  • disconnect:

    Deprecated, will be removed in 2.0, use handle.remove() instead.

    Disconnects handle created by connect.

  • subscribe:

    Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead.

    Subscribes to the specified topic and calls the specified method of this object and registers for unsubscribe() on widget destroy.

    Provide widget-specific analog to dojo.subscribe, except with the implicit use of this widget as the target object.

  • unsubscribe:

    Deprecated, will be removed in 2.0, use handle.remove() instead.

    Unsubscribes handle created by this.subscribe. Also removes handle from this widget's list of subscriptions

  • isLeftToRight:

    Return this widget's explicit or implicit orientation (true for LTR, false for RTL)

  • isFocusable:

    Return true if this widget can currently be focused and false if not

  • placeAt:

    Place this widget somewhere in the DOM based on standard domConstruct.place() conventions.

  • defer:

    Wrapper to setTimeout to avoid deferred functions executing after the originating widget has been destroyed. Returns an object handle with a remove method (that returns null) (replaces clearTimeout).

  • _changeAttrValue:

    Internal helper for directly changing an attribute value.

  • watch:

    Watches a property for changes

  • own:

    Track specified handles and remove/destroy them when this instance is destroyed, unless they were already removed/destroyed manually.

  • focused (Boolean):

    This widget or a widget it contains has focus, or is "active" because it was recently clicked.

  • onFocus:

    Called when the widget becomes "active" because it or a widget inside of it either has focus, or has recently been clicked.

  • onBlur:

    Called when the widget stops being "active" because focus moved to something outside of it, or the user clicked somewhere outside of it, or the widget was hidden.

  • _onFocus:

    This is where widgets do processing for when they are active, such as changing CSS classes. See onFocus() for more details.

  • _onBlur:

    This is where widgets do processing for when they stop being active, such as changing CSS classes. See onBlur() for more details.

  • _focusManager
  • templatePath (String):

    Path to template (HTML file) for this widget relative to dojo.baseUrl. Deprecated: use templateString with require([... "dojo/text!..."], ...) instead

  • _skipNodeCache
  • _rendered (Boolean):

    Not normally use, but this flag can be set by the app if the server has already rendered the template, i.e. already inlining the template for the widget into the main page. Reduces _TemplatedMixin to just function like _AttachMixin.

  • searchContainerNode
  • _stringRepl:

    Does substitution of ${foo} type properties in template string

  • _escapeValue:

    Escape a value to be inserted into the template, either into an attribute value (ex: foo="${bar}") or as inner text of an element (ex: ${foo})

  • _fillContent:

    Relocate source contents to templated container node. this.containerNode must be able to receive children, or exceptions will be thrown.

  • _attachPoints (String[]):

    List of widget attribute names associated with data-dojo-attach-point=... in the template, ex: ["containerNode", "labelNode"]

  • _attachEvents (Handle[]):

    List of connections associated with data-dojo-attach-event=... in the template

  • attachScope (Object):

    Object to which attach points and events will be scoped. Defaults to 'this'.

  • _beforeFillContent
  • _attachTemplateNodes:

    Iterate through the dom nodes and attach functions and nodes accordingly.

  • _processTemplateNode:

    Process data-dojo-attach-point and data-dojo-attach-event for given node or widget. Returns true if caller should process baseNode's children too.

  • _attach:

    Roughly corresponding to dojo/on, this is the default function for processing a data-dojo-attach-event. Meant to attach to DOMNodes, not to widgets.

  • _detachTemplateNodes:

    Detach and clean up the attachments made in _attachtempalteNodes.

  • addChild:

    Makes the given widget a child of this widget.

  • hasChildren:

    Returns true if widget has child widgets, i.e. if this.containerNode contains widgets.

  • _getSiblingOfChild:

    Get the next or previous widget sibling of child

  • getIndexOfChild:

    Gets the index of the child in this container or -1 if not found

  • _getSibling:

    Returns next or previous sibling

  • getPreviousSibling:

    Returns null if this is the first child of the parent, otherwise returns the next element sibling to the "left".

  • getNextSibling:

    Returns null if this is the last child of the parent, otherwise returns the next element sibling to the "right".

  • getIndexInParent:

    Returns the index of this widget within its container parent. It returns -1 if the parent does not exist, or if the parent is not a dijit/_Container

  • hovering (Boolean):

    True if cursor is over this widget

  • active (Boolean):

    True if mouse was pressed while over this widget, and hasn't been released yet

  • _cssMouseEvent:

    Handler for CSS event on this.domNode. Sets hovering and active properties depending on mouse state, which triggers _setStateClass() to set appropriate CSS classes for this.domNode.

  • _setStateClass:

    Update the visual state of the widget by setting the css classes on this.domNode (or this.stateNode if defined) by combining this.baseClass with various suffixes that represent the current widget state(s).

  • _subnodeCssMouseEvent:

    Handler for hover/active mouse event on widget's subnode

  • _trackMouseState:

    Track mouse/focus events on specified node and set CSS class on that node to indicate current state. Usually not called directly, but via cssStateNodes attribute.

Returns:any | undefined

Promise that resolves when the node has finished closing

_createTreeNode(args)
Defined by dijit/Tree

creates a TreeNode

Developers can override this method to define their own TreeNode class; However it will probably be removed in a future release in favor of a way of just specifying a widget for the label, rather than one that contains the children too.

Parameter Type Description
args Object
Returns:instance
_cssMouseEvent(event)

Handler for CSS event on this.domNode. Sets hovering and active properties depending on mouse state, which triggers _setStateClass() to set appropriate CSS classes for this.domNode.

Parameter Type Description
event Event
_detachTemplateNodes()
Defined by dijit/_AttachMixin

Detach and clean up the attachments made in _attachtempalteNodes.

_escapeValue(val)

Escape a value to be inserted into the template, either into an attribute value (ex: foo="${bar}") or as inner text of an element (ex: ${foo})

Parameter Type Description
val String
Returns:undefined
_expandNode(node)
Defined by dijit/Tree

Called when the user has requested to expand the node

Parameter Type Description
node Object

An object with the following properties:

  • item (Item):

    the dojo.data entry this tree represents

  • isTreeNode (Boolean):

    Indicates that this is a TreeNode. Used by dijit.Tree only, should not be accessed directly.

  • label (String):

    Text of this tree node

  • _setLabelAttr
  • labelType (String):

    Specifies how to interpret the label. Can be "html" or "text".

  • isExpandable (Boolean):

    This node has children, so show the expando node (+ sign)

  • isExpanded (Boolean):

    This node is currently expanded (ie, opened)

  • state (String):

    Dynamic loading-related stuff. When an empty folder node appears, it is "NotLoaded" first, then after dojo.data query it becomes "Loading" and, finally "Loaded"

  • templateString
  • baseClass
  • cssStateNodes
  • _setTooltipAttr
  • buildRendering
  • _setIndentAttr:

    Tell this node how many levels it should be indented

  • markProcessing:

    Visually denote that tree is loading data, etc.

  • unmarkProcessing:

    Clear markup from markProcessing() call

  • _updateItemClasses:

    Set appropriate CSS classes for icon and label dom node (used to allow for item updates to change respective CSS)

  • _applyClassAndStyle:

    Set the appropriate CSS classes and styles for labels, icons and rows.

  • _updateLayout:

    Set appropriate CSS classes for this.domNode

  • _setExpando:

    Set the right image for the expando node

  • expand:

    Show my children

  • collapse:

    Collapse this node (if it's expanded)

  • indent (Integer):

    Levels from this node to the root node

  • setChildItems:

    Sets the child items of this node, removing/adding nodes from current children to match specified items[] array. Also, if this.persist == true, expands any children that were previously opened.

  • getTreePath
  • getIdentity
  • removeChild
  • makeExpandable:

    if this node wasn't already showing the expando node, turn it into one and call _setExpando()

  • setSelected:

    A Tree has a (single) currently selected node. Mark that this node is/isn't that currently selected node.

  • focus
  • onClick:

    Connect to this function to receive notifications of mouse click events.

  • onDblClick:

    Connect to this function to receive notifications of mouse double click events.

  • onKeyDown:

    Connect to this function to receive notifications of keys being pressed down.

  • onKeyPress:

    Connect to this function to receive notifications of printable keys being typed.

  • onKeyUp:

    Connect to this function to receive notifications of keys being released.

  • onMouseDown:

    Connect to this function to receive notifications of when the mouse button is pressed down.

  • onMouseMove:

    Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget.

  • onMouseOut:

    Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget.

  • onMouseOver:

    Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget.

  • onMouseLeave:

    Connect to this function to receive notifications of when the mouse moves off of this widget.

  • onMouseEnter:

    Connect to this function to receive notifications of when the mouse moves onto this widget.

  • onMouseUp:

    Connect to this function to receive notifications of when the mouse button is released.

  • postCreate
  • on
  • _setFocusedAttr
  • setAttribute:

    Deprecated. Use set() instead.

  • attr:

    This method is deprecated, use get() or set() directly.

  • getDescendants:

    Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode. This method should generally be avoided as it returns widgets declared in templates, which are supposed to be internal/hidden, but it's left here for back-compat reasons.

  • _onShow:

    Internal method called when this widget is made visible. See onShow for details.

  • onShow:

    Called when this widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.

    Also called to indicate display of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane.

  • onHide:

    Called when another widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.

    Also called to indicate hide of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane.

  • onClose:

    Called when this widget is being displayed as a popup (ex: a Calendar popped up from a DateTextBox), and it is hidden. This is called from the dijit.popup code, and should not be called directly.

    Also used as a parameter for children of dijit/layout/StackContainer or subclasses. Callback if a user tries to close the child. Child will be closed if this function returns true.

  • id (String):

    A unique, opaque ID string that can be assigned by users or by the system. If the developer passes an ID which is known not to be unique, the specified ID is ignored and the system-generated ID is used instead.

  • _setIdAttr
  • lang (String):

    Rarely used. Overrides the default Dojo locale used to render this widget, as defined by the HTML LANG attribute. Value must be among the list of locales specified during by the Dojo bootstrap, formatted according to RFC 3066 (like en-us).

  • _setLangAttr
  • dir (String):

    Bi-directional support, as defined by the HTML DIR attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's default direction.

  • _setDirAttr
  • class
  • _setClassAttr
  • _setTypeAttr
  • style (String||Object):

    HTML style attributes as cssText string or name/value hash

  • title (String):

    HTML title attribute.

    For form widgets this specifies a tooltip to display when hovering over the widget (just like the native HTML title attribute).

    For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer, etc., it's used to specify the tab label, accordion pane title, etc. In this case it's interpreted as HTML.

  • tooltip (String):

    When this widget's title attribute is used to for a tab label, accordion pane title, etc., this specifies the tooltip to appear when the mouse is hovered over that text.

  • srcNodeRef (DomNode):

    pointer to original DOM node

  • domNode (DomNode):

    This is our visible representation of the widget! Other DOM Nodes may by assigned to other properties, usually through the template system's data-dojo-attach-point syntax, but the domNode property is the canonical "top level" node in widget UI.

  • containerNode (DomNode):

    Designates where children of the source DOM node will be placed. "Children" in this case refers to both DOM nodes and widgets. For example, for myWidget:

    1
    2
    3
    4
    5
    <div data-dojo-type=myWidget>
        <b> here's a plain DOM node
        <span data-dojo-type=subWidget>and a widget</span>
        <i> and another plain DOM node </i>
    </div>

    containerNode would point to:

    1
    2
    3
    <b> here's a plain DOM node
    <span data-dojo-type=subWidget>and a widget</span>
    <i> and another plain DOM node </i>

    In templated widgets, "containerNode" is set via a data-dojo-attach-point assignment.

    containerNode must be defined for any widget that accepts innerHTML (like ContentPane or BorderContainer or even Button), and conversely is null for widgets that don't, like TextBox.

  • ownerDocument (Document?, optional):

    The document this widget belongs to. If not specified to constructor, will default to srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global

  • _setOwnerDocumentAttr
  • _started (Boolean):

    startup() has completed.

  • attributeMap (Object):

    Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute for each XXX attribute to be mapped to the DOM.

    attributeMap sets up a "binding" between attributes (aka properties) of the widget and the widget's DOM. Changes to widget attributes listed in attributeMap will be reflected into the DOM.

    For example, calling set('title', 'hello') on a TitlePane will automatically cause the TitlePane's DOM to update with the new title.

    attributeMap is a hash where the key is an attribute of the widget, and the value reflects a binding to a:

    • DOM node attribute

      focus: {node: "focusNode", type: "attribute"} Maps this.focus to this.focusNode.focus

    • DOM node innerHTML

      title: { node: "titleNode", type: "innerHTML" } Maps this.title to this.titleNode.innerHTML

    • DOM node innerText

      title: { node: "titleNode", type: "innerText" } Maps this.title to this.titleNode.innerText

    • DOM node CSS class

      myClass: { node: "domNode", type: "class" } Maps this.myClass to this.domNode.className

    If the value is an array, then each element in the array matches one of the formats of the above list.

    There are also some shorthands for backwards compatibility:

    • string --> { node: string, type: "attribute" }, for example:
    1
    "focusNode" ---> { node: "focusNode", type: "attribute" }
    • "" --> { node: "domNode", type: "attribute" }
  • _blankGif (String):

    Path to a blank 1x1 image. Used by <img> nodes in templates that really get their image via CSS background-image.

  • _introspect:

    Collect metadata about this widget (only once per class, not once per instance):

    1
    2
    - list of attributes with custom setters, storing in this.constructor._setterAttrs
    - generate this.constructor._onMap, mapping names like "mousedown" to functions like onMouseDown
  • postscript:

    Kicks off widget instantiation. See create() for details.

  • create:

    Kick off the life-cycle of a widget

  • _applyAttributes:

    Step during widget creation to copy widget attributes to the DOM according to attributeMap and _setXXXAttr objects, and also to call custom _setXXXAttr() methods.

    Skips over blank/false attribute values, unless they were explicitly specified as parameters to the widget, since those are the default anyway, and setting tabIndex="" is different than not setting tabIndex at all.

    For backwards-compatibility reasons attributeMap overrides _setXXXAttr when _setXXXAttr is a hash/string/array, but _setXXXAttr as a functions override attributeMap.

  • postMixInProperties:

    Called after the parameters to the widget have been read-in, but before the widget template is instantiated. Especially useful to set properties that are referenced in the widget template.

  • startup:

    Processing after the DOM fragment is added to the document

  • destroyRecursive:

    Destroy this widget and its descendants

  • destroy:

    Destroy this widget, but not its descendants. Descendants means widgets inside of this.containerNode. Will also destroy any resources (including widgets) registered via this.own().

    This method will also destroy internal widgets such as those created from a template, assuming those widgets exist inside of this.domNode but outside of this.containerNode.

    For 2.0 it's planned that this method will also destroy descendant widgets, so apps should not depend on the current ability to destroy a widget without destroying its descendants. Generally they should use destroyRecursive() for widgets with children.

  • destroyRendering:

    Destroys the DOM nodes associated with this widget.

  • destroyDescendants:

    Recursively destroy the children of this widget and their descendants.

  • uninitialize:

    Deprecated. Override destroy() instead to implement custom widget tear-down behavior.

  • _setStyleAttr:

    Sets the style attribute of the widget according to value, which is either a hash like {height: "5px", width: "3px"} or a plain string

  • _attrToDom:

    Reflect a widget attribute (title, tabIndex, duration etc.) to the widget DOM, as specified by commands parameter. If commands isn't specified then it's looked up from attributeMap. Note some attributes like "type" cannot be processed this way as they are not mutable.

  • get:

    Get a property from a widget.

  • set:

    Set a property on a widget

  • _attrPairNames
  • _getAttrNames:

    Helper function for get() and set(). Caches attribute name values so we don't do the string ops every time.

  • _set:

    Helper function to set new value for specified property, and call handlers registered with watch() if the value has changed.

  • _get:

    Helper function to get value for specified property stored by this._set(), i.e. for properties with custom setters. Used mainly by custom getters.

    For example, CheckBox._getValueAttr() calls this._get("value").

  • emit:

    Used by widgets to signal that a synthetic event occurred, ex:

    1
    myWidget.emit("attrmodified-selectedChildWidget", {}).

    Emits an event on this.domNode named type.toLowerCase(), based on eventObj. Also calls onType() method, if present, and returns value from that method. By default passes eventObj to callback, but will pass callbackArgs instead, if specified. Modifies eventObj by adding missing parameters (bubbles, cancelable, widget).

  • _onMap:

    Maps on() type parameter (ex: "mousemove") to method name (ex: "onMouseMove"). If type is a synthetic event like touch.press then returns undefined.

  • toString:

    Returns a string that represents the widget.

  • getChildren:

    Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent is this widget. Note that it does not return all descendants, but rather just direct children. Analogous to Node.childNodes, except containing widgets rather than DOMNodes.

    The result intentionally excludes internally created widgets (a.k.a. supporting widgets) outside of this.containerNode.

    Note that the array returned is a simple array. Application code should not assume existence of methods like forEach().

  • getParent:

    Returns the parent widget of this widget.

  • connect:

    Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead.

    Connects specified obj/event to specified method of this object and registers for disconnect() on widget destroy.

    Provide widget-specific analog to dojo.connect, except with the implicit use of this widget as the target object. Events connected with this.connect are disconnected upon destruction.

  • disconnect:

    Deprecated, will be removed in 2.0, use handle.remove() instead.

    Disconnects handle created by connect.

  • subscribe:

    Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead.

    Subscribes to the specified topic and calls the specified method of this object and registers for unsubscribe() on widget destroy.

    Provide widget-specific analog to dojo.subscribe, except with the implicit use of this widget as the target object.

  • unsubscribe:

    Deprecated, will be removed in 2.0, use handle.remove() instead.

    Unsubscribes handle created by this.subscribe. Also removes handle from this widget's list of subscriptions

  • isLeftToRight:

    Return this widget's explicit or implicit orientation (true for LTR, false for RTL)

  • isFocusable:

    Return true if this widget can currently be focused and false if not

  • placeAt:

    Place this widget somewhere in the DOM based on standard domConstruct.place() conventions.

  • defer:

    Wrapper to setTimeout to avoid deferred functions executing after the originating widget has been destroyed. Returns an object handle with a remove method (that returns null) (replaces clearTimeout).

  • _changeAttrValue:

    Internal helper for directly changing an attribute value.

  • watch:

    Watches a property for changes

  • own:

    Track specified handles and remove/destroy them when this instance is destroyed, unless they were already removed/destroyed manually.

  • focused (Boolean):

    This widget or a widget it contains has focus, or is "active" because it was recently clicked.

  • onFocus:

    Called when the widget becomes "active" because it or a widget inside of it either has focus, or has recently been clicked.

  • onBlur:

    Called when the widget stops being "active" because focus moved to something outside of it, or the user clicked somewhere outside of it, or the widget was hidden.

  • _onFocus:

    This is where widgets do processing for when they are active, such as changing CSS classes. See onFocus() for more details.

  • _onBlur:

    This is where widgets do processing for when they stop being active, such as changing CSS classes. See onBlur() for more details.

  • _focusManager
  • templatePath (String):

    Path to template (HTML file) for this widget relative to dojo.baseUrl. Deprecated: use templateString with require([... "dojo/text!..."], ...) instead

  • _skipNodeCache
  • _rendered (Boolean):

    Not normally use, but this flag can be set by the app if the server has already rendered the template, i.e. already inlining the template for the widget into the main page. Reduces _TemplatedMixin to just function like _AttachMixin.

  • searchContainerNode
  • _stringRepl:

    Does substitution of ${foo} type properties in template string

  • _escapeValue:

    Escape a value to be inserted into the template, either into an attribute value (ex: foo="${bar}") or as inner text of an element (ex: ${foo})

  • _fillContent:

    Relocate source contents to templated container node. this.containerNode must be able to receive children, or exceptions will be thrown.

  • _attachPoints (String[]):

    List of widget attribute names associated with data-dojo-attach-point=... in the template, ex: ["containerNode", "labelNode"]

  • _attachEvents (Handle[]):

    List of connections associated with data-dojo-attach-event=... in the template

  • attachScope (Object):

    Object to which attach points and events will be scoped. Defaults to 'this'.

  • _beforeFillContent
  • _attachTemplateNodes:

    Iterate through the dom nodes and attach functions and nodes accordingly.

  • _processTemplateNode:

    Process data-dojo-attach-point and data-dojo-attach-event for given node or widget. Returns true if caller should process baseNode's children too.

  • _attach:

    Roughly corresponding to dojo/on, this is the default function for processing a data-dojo-attach-event. Meant to attach to DOMNodes, not to widgets.

  • _detachTemplateNodes:

    Detach and clean up the attachments made in _attachtempalteNodes.

  • addChild:

    Makes the given widget a child of this widget.

  • hasChildren:

    Returns true if widget has child widgets, i.e. if this.containerNode contains widgets.

  • _getSiblingOfChild:

    Get the next or previous widget sibling of child

  • getIndexOfChild:

    Gets the index of the child in this container or -1 if not found

  • _getSibling:

    Returns next or previous sibling

  • getPreviousSibling:

    Returns null if this is the first child of the parent, otherwise returns the next element sibling to the "left".

  • getNextSibling:

    Returns null if this is the last child of the parent, otherwise returns the next element sibling to the "right".

  • getIndexInParent:

    Returns the index of this widget within its container parent. It returns -1 if the parent does not exist, or if the parent is not a dijit/_Container

  • hovering (Boolean):

    True if cursor is over this widget

  • active (Boolean):

    True if mouse was pressed while over this widget, and hasn't been released yet

  • _cssMouseEvent:

    Handler for CSS event on this.domNode. Sets hovering and active properties depending on mouse state, which triggers _setStateClass() to set appropriate CSS classes for this.domNode.

  • _setStateClass:

    Update the visual state of the widget by setting the css classes on this.domNode (or this.stateNode if defined) by combining this.baseClass with various suffixes that represent the current widget state(s).

  • _subnodeCssMouseEvent:

    Handler for hover/active mouse event on widget's subnode

  • _trackMouseState:

    Track mouse/focus events on specified node and set CSS class on that node to indicate current state. Usually not called directly, but via cssStateNodes attribute.

Returns:any | undefined

Promise that resolves when the node is loaded and opened and (if persist=true) all it's descendants that were previously opened too

_fillContent(source)

Relocate source contents to templated container node. this.containerNode must be able to receive children, or exceptions will be thrown.

Parameter Type Description
source DomNode
_get(name)
Defined by dijit/_WidgetBase

Helper function to get value for specified property stored by this._set(), i.e. for properties with custom setters. Used mainly by custom getters.

For example, CheckBox._getValueAttr() calls this._get("value").

Parameter Type Description
name String
Returns:undefined
_getAttrNames(name)
Defined by dijit/_WidgetBase

Helper function for get() and set(). Caches attribute name values so we don't do the string ops every time.

Parameter Type Description
name undefined
Returns:undefined | object
_getFirst()
Defined by dijit/Tree

Returns the first child.

Returns:undefined
_getFirstFocusableChild()
Defined by dijit/_KeyNavMixin

Returns first child that can be focused.

Returns:undefined
_getLast()
Defined by dijit/Tree

Returns the last descendant.

Returns:undefined
_getLastFocusableChild()
Defined by dijit/_KeyNavMixin

Returns last child that can be focused.

Returns:undefined
_getNext(node)
Defined by dijit/Tree

Returns the next descendant, compared to "child".

Parameter Type Description
node Widget

The current widget

Returns:undefined | null
_getNextFocusableChild(child,dir)
Defined by dijit/_KeyNavMixin

Returns the next or previous focusable descendant, compared to "child". Implements and extends _KeyNavMixin._getNextFocusableChild() for a _Container.

Parameter Type Description
child Widget

The current widget

dir Integer
  • 1 = after
  • -1 = before
Returns:undefined | null
_getNextNode(node)
Defined by dijit/Tree

Get next visible node

Parameter Type Description
node undefined
Returns:undefined
_getRootOrFirstNode()
Defined by dijit/Tree

Get first visible node

Returns:undefined
_initState()
Defined by dijit/Tree

Load in which nodes should be opened automatically

_introspect()
Defined by dijit/_WidgetBase

Collect metadata about this widget (only once per class, not once per instance):

1
2
- list of attributes with custom setters, storing in this.constructor._setterAttrs
- generate this.constructor._onMap, mapping names like "mousedown" to functions like onMouseDown
_keyboardSearch(evt,keyChar)
Defined by dijit/_KeyNavMixin

Perform a search of the widget's options based on the user's keyboard activity

Called on keypress (and sometimes keydown), searches through this widget's children looking for items that match the user's typed search string. Multiple characters typed within 1 sec of each other are combined for multicharacter searching.

Parameter Type Description
evt Event
keyChar String
_keyboardSearchCompare(item,searchString)
Defined by dijit/_KeyNavMixin

Compares the searchString to the widget's text label, returning:

1
2
3
* -1: a high priority match  and stop searching
* 0: not a match
* 1: a match but keep looking for a higher priority match
Parameter Type Description
item dijit/_WidgetBase
searchString String
Returns:number
_load()
Defined by dijit/Tree

Initial load of the tree. Load root node (possibly hidden) and it's children.

_processTemplateNode(baseNode,getAttrFunc,attachFunc)
Defined by dijit/_AttachMixin

Process data-dojo-attach-point and data-dojo-attach-event for given node or widget. Returns true if caller should process baseNode's children too.

Parameter Type Description
baseNode DOMNode | Widget
getAttrFunc Function

Function to get the specified property for a given DomNode/Widget.

attachFunc Function
Optional

Attaches an event handler from the specified node/widget to specified function.

Returns:boolean
_publish(topicName,message)
Defined by dijit/Tree

Publish a message for this widget/topic

Parameter Type Description
topicName String
message Object
_saveExpandedNodes()
Defined by dijit/Tree
_set(name,value)
Defined by dijit/_WidgetBase

Helper function to set new value for specified property, and call handlers registered with watch() if the value has changed.

Parameter Type Description
name String
value anything
_setFocusedAttr(val)
Defined by dijit/_Widget
Parameter Type Description
val undefined
_setOwnerDocumentAttr(val)
Defined by dijit/_WidgetBase
Parameter Type Description
val undefined
_setPathAttr(path)
Defined by dijit/Tree

Singular variant of _setPathsAttr

Parameter Type Description
path Item[] | String[]
_setPathsAttr(paths)
Defined by dijit/Tree

Select the tree nodes identified by passed paths.

Parameter Type Description
paths Item[][] | String[][]

Array of arrays of items or item id's

Returns:any | undefined

Promise to indicate when the set is complete

_setSelectedItemAttr(item)
Defined by dijit/Tree
Parameter Type Description
item Item or id
_setSelectedItemsAttr(items)
Defined by dijit/Tree

Select tree nodes related to passed items. WARNING: if model use multi-parented items or desired tree node isn't already loaded behavior is undefined. Use set('paths', ...) instead.

Parameter Type Description
items Items or ids
Returns:undefined
_setSelectedNodeAttr(node)
Defined by dijit/Tree
Parameter Type Description
node undefined
_setSelectedNodesAttr(nodes)
Defined by dijit/Tree

Marks the specified TreeNodes as selected.

Parameter Type Description
nodes Object

TreeNodes to mark.

_setStateClass()

Update the visual state of the widget by setting the css classes on this.domNode (or this.stateNode if defined) by combining this.baseClass with various suffixes that represent the current widget state(s).

In the case where a widget has multiple states, it sets the class based on all possible combinations. For example, an invalid form widget that is being hovered will be "dijitInput dijitInputInvalid dijitInputHover dijitInputInvalidHover".

The widget may have one or more of the following states, determined by this.state, this.checked, this.valid, and this.selected:

  • Error - ValidationTextBox sets this.state to "Error" if the current input value is invalid
  • Incomplete - ValidationTextBox sets this.state to "Incomplete" if the current input value is not finished yet
  • Checked - ex: a checkmark or a ToggleButton in a checked state, will have this.checked==true
  • Selected - ex: currently selected tab will have this.selected==true

In addition, it may have one or more of the following states, based on this.disabled and flags set in _onMouse (this.active, this.hovering) and from focus manager (this.focused):

  • Disabled - if the widget is disabled
  • Active - if the mouse (or space/enter key?) is being pressed down
  • Focused - if the widget has focus
  • Hover - if the mouse is over the widget
_setStyleAttr(value)
Defined by dijit/_WidgetBase

Sets the style attribute of the widget according to value, which is either a hash like {height: "5px", width: "3px"} or a plain string

Determines which node to set the style on based on style setting in attributeMap.

Parameter Type Description
value String | Object
_startPaint(p)
Defined by dijit/Tree

Called at the start of an operation that will change what's displayed.

Parameter Type Description
p Promise | Boolean

Promise that tells when the operation will complete. Alternately, if it's just a Boolean, it signifies that the operation was synchronous, and already completed.

_state(node,expanded)
Defined by dijit/Tree

Query or set expanded state for an node

Parameter Type Description
node undefined
expanded undefined
Returns:boolean | undefined
_store2model()
Defined by dijit/Tree

User specified a store&query rather than model, so create model from store/query

_stringRepl(tmpl)

Does substitution of ${foo} type properties in template string

Parameter Type Description
tmpl undefined
Returns:undefined
_subnodeCssMouseEvent(node,clazz,evt)

Handler for hover/active mouse event on widget's subnode

Parameter Type Description
node undefined
clazz undefined
evt undefined
_trackMouseState(node,clazz)

Track mouse/focus events on specified node and set CSS class on that node to indicate current state. Usually not called directly, but via cssStateNodes attribute.

Given class=foo, will set the following CSS class on the node

  • fooActive: if the user is currently pressing down the mouse button while over the node
  • fooHover: if the user is hovering the mouse over the node, but not pressing down a button
  • fooFocus: if the node is focused

Note that it won't set any classes if the widget is disabled.

Parameter Type Description
node DomNode

Should be a sub-node of the widget, not the top node (this.domNode), since the top node is handled specially and automatically just by mixing in this class.

clazz String

CSS class name (ex: dijitSliderUpArrow)

_TreeNode()
Defined by dijit/Tree
attr(name,value)
Defined by dijit/_Widget

This method is deprecated, use get() or set() directly.

Parameter Type Description
name String | Object

The property to get or set. If an object is passed here and not a string, its keys are used as names of attributes to be set and the value of the object as values to set in the widget.

value Object
Optional

Optional. If provided, attr() operates as a setter. If omitted, the current value of the named property is returned.

Returns:undefined
buildRendering()
Defined by dijit/_WidgetBase

Construct the UI for this widget, setting this.domNode. Most widgets will mixin dijit._TemplatedMixin, which implements this method.

collapseAll()
Defined by dijit/Tree

Collapse all nodes in the tree

Returns:any | undefined

Promise that resolves when all nodes have collapsed

connect(obj,event,method)
Defined by dijit/_WidgetBase

Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead.

Connects specified obj/event to specified method of this object and registers for disconnect() on widget destroy.

Provide widget-specific analog to dojo.connect, except with the implicit use of this widget as the target object. Events connected with this.connect are disconnected upon destruction.

Parameter Type Description
obj Object | null
event String | Function
method String | Function
Returns:any | undefined

A handle that can be passed to disconnect in order to disconnect before the widget is destroyed.

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when foo.bar() is called, call the listener we're going to
// provide in the scope of btn
btn.connect(foo, "bar", function(){
    console.debug(this.toString());
});
create(params,srcNodeRef)
Defined by dijit/_WidgetBase

Kick off the life-cycle of a widget

Create calls a number of widget methods (postMixInProperties, buildRendering, postCreate, etc.), some of which of you'll want to override. See http://dojotoolkit.org/reference-guide/dijit/_WidgetBase.html for a discussion of the widget creation lifecycle.

Of course, adventurous developers could override create entirely, but this should only be done as a last resort.

Parameter Type Description
params Object | null

Hash of initialization parameters for widget, including scalar values (like title, duration etc.) and functions, typically callbacks like onClick. The hash can contain any of the widget's properties, excluding read-only properties.

srcNodeRef DOMNode | String
Optional

If a srcNodeRef (DOM node) is specified:

  • use srcNodeRef.innerHTML as my contents
  • if this is a behavioral widget then apply behavior to that srcNodeRef
  • otherwise, replace srcNodeRef with my generated DOM tree
defer(fcn,delay)
Defined by dijit/_WidgetBase

Wrapper to setTimeout to avoid deferred functions executing after the originating widget has been destroyed. Returns an object handle with a remove method (that returns null) (replaces clearTimeout).

Parameter Type Description
fcn Function

Function reference.

delay Number
Optional

Delay, defaults to 0.

Returns:object
destroy()
Defined by dijit/Tree
destroyDescendants(preserveDom)
Defined by dijit/_WidgetBase

Recursively destroy the children of this widget and their descendants.

Parameter Type Description
preserveDom Boolean
Optional

If true, the preserveDom attribute is passed to all descendant widget's .destroy() method. Not for use with _Templated widgets.

destroyRecursive()
Defined by dijit/Tree
destroyRendering(preserveDom)
Defined by dijit/_WidgetBase

Destroys the DOM nodes associated with this widget.

Parameter Type Description
preserveDom Boolean
Optional

If true, this method will leave the original DOM structure alone during tear-down. Note: this will not work with _Templated widgets yet.

disconnect(handle)
Defined by dijit/_WidgetBase

Deprecated, will be removed in 2.0, use handle.remove() instead.

Disconnects handle created by connect.

Parameter Type Description
handle undefined
dndController()
Defined by dijit/Tree

Class to use as as the dnd controller. Specifying this class enables DnD. Generally you should specify this as dijit/tree/dndSource. Setting of dijit/tree/_dndSelector handles selection only (no actual DnD).

emit(type,eventObj,callbackArgs)
Defined by dijit/_WidgetBase

Used by widgets to signal that a synthetic event occurred, ex:

1
myWidget.emit("attrmodified-selectedChildWidget", {}).

Emits an event on this.domNode named type.toLowerCase(), based on eventObj. Also calls onType() method, if present, and returns value from that method. By default passes eventObj to callback, but will pass callbackArgs instead, if specified. Modifies eventObj by adding missing parameters (bubbles, cancelable, widget).

Parameter Type Description
type String
eventObj Object
Optional
callbackArgs Array
Optional
Returns:undefined
expandAll()
Defined by dijit/Tree

Expand all nodes in the tree

Returns:any | undefined

Promise that resolves when all nodes have expanded

focus()
Defined by dijit/Tree

Default focus() implementation: focus the previously focused child, or first child. Some applications may want to change this method to focus the [first] selected child.

focusChild(widget,last)
Defined by dijit/_KeyNavMixin

Focus specified child widget.

Parameter Type Description
widget dijit/_WidgetBase

Reference to container's child widget

last Boolean

If true and if widget has multiple focusable nodes, focus the last one instead of the first one

focusFirstChild()
Defined by dijit/_KeyNavMixin

Focus the first focusable child in the container.

focusLastChild()
Defined by dijit/Tree

End key pressed; go to last visible node.

focusNode(node)
Defined by dijit/Tree

Focus on the specified node (which must be visible)

Parameter Type Description
node _tree.Node
get(name)
Defined by dijit/_WidgetBase

Get a property from a widget.

Get a named property from a widget. The property may potentially be retrieved via a getter method. If no getter is defined, this just retrieves the object's property.

For example, if the widget has properties foo and bar and a method named _getFooAttr(), calling: myWidget.get("foo") would be equivalent to calling widget._getFooAttr() and myWidget.get("bar") would be equivalent to the expression widget.bar2

Parameter Type Description
name undefined

The property to get.

Returns:undefined
getChildren()
Defined by dijit/_WidgetBase

Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent is this widget. Note that it does not return all descendants, but rather just direct children. Analogous to Node.childNodes, except containing widgets rather than DOMNodes.

The result intentionally excludes internally created widgets (a.k.a. supporting widgets) outside of this.containerNode.

Note that the array returned is a simple array. Application code should not assume existence of methods like forEach().

Returns:Array
getDescendants()
Defined by dijit/_Widget

Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode. This method should generally be avoided as it returns widgets declared in templates, which are supposed to be internal/hidden, but it's left here for back-compat reasons.

Returns:Array
getIconClass(item,opened)
Defined by dijit/Tree

Overridable function to return CSS class name to display icon

Parameter Type Description
item dojo/data/Item
opened Boolean
Returns:string
getIconStyle(item,opened)
Defined by dijit/Tree

Overridable function to return CSS styles to display icon

Parameter Type Description
item dojo/data/Item
opened Boolean
Returns:Object

Object suitable for input to dojo.style() like {backgroundImage: "url(...)"}

getItemChildren(parentItem,onComplete)
Defined by dijit/Tree

Deprecated. This should be specified on the model itself.

Overridable function that return array of child items of given parent item, or if parentItem==null then return top items in tree

Parameter Type Description
parentItem undefined
onComplete undefined
getLabel(item)
Defined by dijit/Tree

Overridable function to get the label for a tree node (given the item)

Parameter Type Description
item dojo/data/Item
Returns:undefined
getLabelClass(item,opened)
Defined by dijit/Tree

Overridable function to return CSS class name to display label

Parameter Type Description
item dojo/data/Item
opened Boolean
Returns:String

CSS class name

getLabelStyle(item,opened)
Defined by dijit/Tree

Overridable function to return CSS styles to display label

Parameter Type Description
item dojo/data/Item
opened Boolean
Returns:any

Object suitable for input to dojo.style() like {color: "red", background: "green"}

getNodesByItem(item)
Defined by dijit/Tree

Returns all tree nodes that refer to an item

Parameter Type Description
item Item or id
Returns:any | Array | undefined

Array of tree nodes that refer to passed item

getParent()
Defined by dijit/_WidgetBase

Returns the parent widget of this widget.

Returns:undefined
getRowClass(item,opened)
Defined by dijit/Tree

Overridable function to return CSS class name to display row

Parameter Type Description
item dojo/data/Item
opened Boolean
Returns:String

CSS class name

getRowStyle(item,opened)
Defined by dijit/Tree

Overridable function to return CSS styles to display row

Parameter Type Description
item dojo/data/Item
opened Boolean
Returns:any

Object suitable for input to dojo.style() like {background-color: "#bbb"}

getTooltip(item)
Defined by dijit/Tree

Overridable function to get the tooltip for a tree node (given the item)

Parameter Type Description
item dojo/data/Item
Returns:string
isExpandoNode(node,widget)
Defined by dijit/Tree

check whether a dom node is the expandoNode for a particular TreeNode widget

Parameter Type Description
node undefined
widget undefined
Returns:undefined
isFocusable()
Defined by dijit/_WidgetBase

Return true if this widget can currently be focused and false if not

Returns:undefined
isLeftToRight()
Defined by dijit/_WidgetBase

Return this widget's explicit or implicit orientation (true for LTR, false for RTL)

Returns:undefined
itemCreator(nodes,target,source)
Defined by dijit/Tree

Returns objects passed to Tree.model.newItem() based on DnD nodes dropped onto the tree. Developer must override this method to enable dropping from external sources onto this Tree, unless the Tree.model's items happen to look like {id: 123, name: "Apple" } with no other attributes.

For each node in nodes[], which came from source, create a hash of name/value pairs to be passed to Tree.model.newItem(). Returns array of those hashes.

Parameter Type Description
nodes DomNode[]

The DOMNodes dragged from the source container

target DomNode

The target TreeNode.rowNode

source dojo/dnd/Source

The source container the nodes were dragged from, perhaps another Tree or a plain dojo/dnd/Source

Returns:Object[] | Array

Array of name/value hashes for each new item to be added to the Tree, like:

1
2
3
4
[
    { id: 123, label: "apple", foo: "bar" },
    { id: 456, label: "pear", zaz: "bam" }
]
mayHaveChildren(item)
Defined by dijit/Tree

Deprecated. This should be specified on the model itself.

Overridable function to tell if an item has or may have children. Controls whether or not +/- expando icon is shown. (For efficiency reasons we may not want to check if an element actually has children until user clicks the expando node)

Parameter Type Description
item dojo/data/Item
on(type,func)
Defined by dijit/_Widget
Parameter Type Description
type String | Function

protected

func Function
Returns:undefined
own()
Defined by dijit/Destroyable

Track specified handles and remove/destroy them when this instance is destroyed, unless they were already removed/destroyed manually.

Returns:any | undefined

The array of specified handles, so you can do for example:

1
var handle = this.own(on(...))[0];
placeAt(reference,position)
Defined by dijit/_WidgetBase

Place this widget somewhere in the DOM based on standard domConstruct.place() conventions.

A convenience function provided in all _Widgets, providing a simple shorthand mechanism to put an existing (or newly created) Widget somewhere in the dom, and allow chaining.

Parameter Type Description
reference String | DomNode | DocumentFragment | dijit/_WidgetBase

Widget, DOMNode, DocumentFragment, or id of widget or DOMNode

position String | Int
Optional

If reference is a widget (or id of widget), and that widget has an ".addChild" method, it will be called passing this widget instance into that method, supplying the optional position index passed. In this case position (if specified) should be an integer.

If reference is a DOMNode (or id matching a DOMNode but not a widget), the position argument can be a numeric index or a string "first", "last", "before", or "after", same as dojo/dom-construct::place().

Returns:dijit/_WidgetBase | function

Provides a useful return of the newly created dijit._Widget instance so you can "chain" this function by instantiating, placing, then saving the return value to a variable.

Examples

Example 1

1
2
3
4
// create a Button with no srcNodeRef, and place it in the body:
var button = new Button({ label:"click" }).placeAt(win.body());
// now, 'button' is still the widget reference to the newly created button
button.on("click", function(e){ console.log('click'); }));

Example 2

1
2
// create a button out of a node with id="src" and append it to id="wrapper":
var button = new Button({},"src").placeAt("wrapper");

Example 3

1
2
// place a new button as the first element of some div
var button = new Button({ label:"click" }).placeAt("wrapper","first");

Example 4

1
2
3
// create a contentpane and add it to a TabContainer
var tc = dijit.byId("myTabs");
new ContentPane({ href:"foo.html", title:"Wow!" }).placeAt(tc)
postCreate()
Defined by dijit/Tree
postMixInProperties()
Defined by dijit/Tree
postscript(params,srcNodeRef)
Defined by dijit/_WidgetBase

Kicks off widget instantiation. See create() for details.

Parameter Type Description
params Object
Optional
srcNodeRef DomNode | String
resize(changeSize)
Defined by dijit/Tree
Parameter Type Description
changeSize undefined
set(name,value)
Defined by dijit/_WidgetBase

Set a property on a widget

Sets named properties on a widget which may potentially be handled by a setter in the widget.

For example, if the widget has properties foo and bar and a method named _setFooAttr(), calling myWidget.set("foo", "Howdy!") would be equivalent to calling widget._setFooAttr("Howdy!") and myWidget.set("bar", 3) would be equivalent to the statement widget.bar = 3;

set() may also be called with a hash of name/value pairs, ex:

1
2
3
4
myWidget.set({
    foo: "Howdy",
    bar: 3
});

This is equivalent to calling set(foo, "Howdy") and set(bar, 3)

Parameter Type Description
name undefined

The property to set.

value undefined

The value to set in the property.

Returns:function | string

Set a property on a widget

setAttribute(attr,value)
Defined by dijit/_Widget

Deprecated. Use set() instead.

Parameter Type Description
attr String
value anything
startup()
Defined by dijit/_WidgetBase

Processing after the DOM fragment is added to the document

Called after a widget and its children have been created and added to the page, and all related widgets have finished their create() cycle, up through postCreate().

Note that startup() may be called while the widget is still hidden, for example if the widget is inside a hidden dijit/Dialog or an unselected tab of a dijit/layout/TabContainer. For widgets that need to do layout, it's best to put that layout code inside resize(), and then extend dijit/layout/_LayoutWidget so that resize() is called when the widget is visible.

subscribe(t,method)
Defined by dijit/_WidgetBase

Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead.

Subscribes to the specified topic and calls the specified method of this object and registers for unsubscribe() on widget destroy.

Provide widget-specific analog to dojo.subscribe, except with the implicit use of this widget as the target object.

Parameter Type Description
t String

The topic

method Function

The callback

Returns:undefined

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
toString()
Defined by dijit/_WidgetBase

Returns a string that represents the widget.

When a widget is cast to a string, this method will be used to generate the output. Currently, it does not implement any sort of reversible serialization.

Returns:string
uninitialize()
Defined by dijit/_WidgetBase

Deprecated. Override destroy() instead to implement custom widget tear-down behavior.

Returns:boolean
unsubscribe(handle)
Defined by dijit/_WidgetBase

Deprecated, will be removed in 2.0, use handle.remove() instead.

Unsubscribes handle created by this.subscribe. Also removes handle from this widget's list of subscriptions

Parameter Type Description
handle Object
watch(name,callback)
Defined by dojo/Stateful

Watches a property for changes

Parameter Type Description
name String
Optional

Indicates the property to watch. This is optional (the callback may be the only parameter), and if omitted, all the properties will be watched

callback Function

The function to execute when the property changes. This will be called after the property has been changed. The callback will be called with the |this| set to the instance, the first argument as the name of the property, the second argument as the old value and the third argument as the new value.

Returns:any | object

An object handle for the watch. The unwatch method of this object can be used to discontinue watching this property:

1
2
var watchHandle = obj.watch("foo", callback);
watchHandle.unwatch(); // callback won't be called now

Events

_onBlur()
Defined by: dijit/_FocusMixin

This is where widgets do processing for when they stop being active, such as changing CSS classes. See onBlur() for more details.

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
_onChildBlur(widget)
Defined by: dijit/_KeyNavMixin

Called when focus leaves a child widget to go to a sibling widget. Used to be used by MenuBase.js (remove for 2.0)

Parameter Type Description
widget dijit/_WidgetBase

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
_onChildFocus(child)
Defined by: dijit/_KeyNavMixin

Called when a child widget gets focus, either by user clicking it, or programatically by arrow key handling code.

It marks that the current node is the selected one, and the previously selected node no longer is.

Parameter Type Description
child dijit/_WidgetBase

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
_onClick(nodeWidget,e)
Defined by: dijit/Tree

Translates click events into commands for the controller to process

Parameter Type Description
nodeWidget Object

An object with the following properties:

  • item (Item):

    the dojo.data entry this tree represents

  • isTreeNode (Boolean):

    Indicates that this is a TreeNode. Used by dijit.Tree only, should not be accessed directly.

  • label (String):

    Text of this tree node

  • _setLabelAttr
  • labelType (String):

    Specifies how to interpret the label. Can be "html" or "text".

  • isExpandable (Boolean):

    This node has children, so show the expando node (+ sign)

  • isExpanded (Boolean):

    This node is currently expanded (ie, opened)

  • state (String):

    Dynamic loading-related stuff. When an empty folder node appears, it is "NotLoaded" first, then after dojo.data query it becomes "Loading" and, finally "Loaded"

  • templateString
  • baseClass
  • cssStateNodes
  • _setTooltipAttr
  • buildRendering
  • _setIndentAttr:

    Tell this node how many levels it should be indented

  • markProcessing:

    Visually denote that tree is loading data, etc.

  • unmarkProcessing:

    Clear markup from markProcessing() call

  • _updateItemClasses:

    Set appropriate CSS classes for icon and label dom node (used to allow for item updates to change respective CSS)

  • _applyClassAndStyle:

    Set the appropriate CSS classes and styles for labels, icons and rows.

  • _updateLayout:

    Set appropriate CSS classes for this.domNode

  • _setExpando:

    Set the right image for the expando node

  • expand:

    Show my children

  • collapse:

    Collapse this node (if it's expanded)

  • indent (Integer):

    Levels from this node to the root node

  • setChildItems:

    Sets the child items of this node, removing/adding nodes from current children to match specified items[] array. Also, if this.persist == true, expands any children that were previously opened.

  • getTreePath
  • getIdentity
  • removeChild
  • makeExpandable:

    if this node wasn't already showing the expando node, turn it into one and call _setExpando()

  • setSelected:

    A Tree has a (single) currently selected node. Mark that this node is/isn't that currently selected node.

  • focus
  • onClick:

    Connect to this function to receive notifications of mouse click events.

  • onDblClick:

    Connect to this function to receive notifications of mouse double click events.

  • onKeyDown:

    Connect to this function to receive notifications of keys being pressed down.

  • onKeyPress:

    Connect to this function to receive notifications of printable keys being typed.

  • onKeyUp:

    Connect to this function to receive notifications of keys being released.

  • onMouseDown:

    Connect to this function to receive notifications of when the mouse button is pressed down.

  • onMouseMove:

    Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget.

  • onMouseOut:

    Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget.

  • onMouseOver:

    Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget.

  • onMouseLeave:

    Connect to this function to receive notifications of when the mouse moves off of this widget.

  • onMouseEnter:

    Connect to this function to receive notifications of when the mouse moves onto this widget.

  • onMouseUp:

    Connect to this function to receive notifications of when the mouse button is released.

  • postCreate
  • on
  • _setFocusedAttr
  • setAttribute:

    Deprecated. Use set() instead.

  • attr:

    This method is deprecated, use get() or set() directly.

  • getDescendants:

    Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode. This method should generally be avoided as it returns widgets declared in templates, which are supposed to be internal/hidden, but it's left here for back-compat reasons.

  • _onShow:

    Internal method called when this widget is made visible. See onShow for details.

  • onShow:

    Called when this widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.

    Also called to indicate display of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane.

  • onHide:

    Called when another widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.

    Also called to indicate hide of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane.

  • onClose:

    Called when this widget is being displayed as a popup (ex: a Calendar popped up from a DateTextBox), and it is hidden. This is called from the dijit.popup code, and should not be called directly.

    Also used as a parameter for children of dijit/layout/StackContainer or subclasses. Callback if a user tries to close the child. Child will be closed if this function returns true.

  • id (String):

    A unique, opaque ID string that can be assigned by users or by the system. If the developer passes an ID which is known not to be unique, the specified ID is ignored and the system-generated ID is used instead.

  • _setIdAttr
  • lang (String):

    Rarely used. Overrides the default Dojo locale used to render this widget, as defined by the HTML LANG attribute. Value must be among the list of locales specified during by the Dojo bootstrap, formatted according to RFC 3066 (like en-us).

  • _setLangAttr
  • dir (String):

    Bi-directional support, as defined by the HTML DIR attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's default direction.

  • _setDirAttr
  • class
  • _setClassAttr
  • _setTypeAttr
  • style (String||Object):

    HTML style attributes as cssText string or name/value hash

  • title (String):

    HTML title attribute.

    For form widgets this specifies a tooltip to display when hovering over the widget (just like the native HTML title attribute).

    For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer, etc., it's used to specify the tab label, accordion pane title, etc. In this case it's interpreted as HTML.

  • tooltip (String):

    When this widget's title attribute is used to for a tab label, accordion pane title, etc., this specifies the tooltip to appear when the mouse is hovered over that text.

  • srcNodeRef (DomNode):

    pointer to original DOM node

  • domNode (DomNode):

    This is our visible representation of the widget! Other DOM Nodes may by assigned to other properties, usually through the template system's data-dojo-attach-point syntax, but the domNode property is the canonical "top level" node in widget UI.

  • containerNode (DomNode):

    Designates where children of the source DOM node will be placed. "Children" in this case refers to both DOM nodes and widgets. For example, for myWidget:

    1
    2
    3
    4
    5
    <div data-dojo-type=myWidget>
        <b> here's a plain DOM node
        <span data-dojo-type=subWidget>and a widget</span>
        <i> and another plain DOM node </i>
    </div>

    containerNode would point to:

    1
    2
    3
    <b> here's a plain DOM node
    <span data-dojo-type=subWidget>and a widget</span>
    <i> and another plain DOM node </i>

    In templated widgets, "containerNode" is set via a data-dojo-attach-point assignment.

    containerNode must be defined for any widget that accepts innerHTML (like ContentPane or BorderContainer or even Button), and conversely is null for widgets that don't, like TextBox.

  • ownerDocument (Document?, optional):

    The document this widget belongs to. If not specified to constructor, will default to srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global

  • _setOwnerDocumentAttr
  • _started (Boolean):

    startup() has completed.

  • attributeMap (Object):

    Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute for each XXX attribute to be mapped to the DOM.

    attributeMap sets up a "binding" between attributes (aka properties) of the widget and the widget's DOM. Changes to widget attributes listed in attributeMap will be reflected into the DOM.

    For example, calling set('title', 'hello') on a TitlePane will automatically cause the TitlePane's DOM to update with the new title.

    attributeMap is a hash where the key is an attribute of the widget, and the value reflects a binding to a:

    • DOM node attribute

      focus: {node: "focusNode", type: "attribute"} Maps this.focus to this.focusNode.focus

    • DOM node innerHTML

      title: { node: "titleNode", type: "innerHTML" } Maps this.title to this.titleNode.innerHTML

    • DOM node innerText

      title: { node: "titleNode", type: "innerText" } Maps this.title to this.titleNode.innerText

    • DOM node CSS class

      myClass: { node: "domNode", type: "class" } Maps this.myClass to this.domNode.className

    If the value is an array, then each element in the array matches one of the formats of the above list.

    There are also some shorthands for backwards compatibility:

    • string --> { node: string, type: "attribute" }, for example:
    1
    "focusNode" ---> { node: "focusNode", type: "attribute" }
    • "" --> { node: "domNode", type: "attribute" }
  • _blankGif (String):

    Path to a blank 1x1 image. Used by <img> nodes in templates that really get their image via CSS background-image.

  • _introspect:

    Collect metadata about this widget (only once per class, not once per instance):

    1
    2
    - list of attributes with custom setters, storing in this.constructor._setterAttrs
    - generate this.constructor._onMap, mapping names like "mousedown" to functions like onMouseDown
  • postscript:

    Kicks off widget instantiation. See create() for details.

  • create:

    Kick off the life-cycle of a widget

  • _applyAttributes:

    Step during widget creation to copy widget attributes to the DOM according to attributeMap and _setXXXAttr objects, and also to call custom _setXXXAttr() methods.

    Skips over blank/false attribute values, unless they were explicitly specified as parameters to the widget, since those are the default anyway, and setting tabIndex="" is different than not setting tabIndex at all.

    For backwards-compatibility reasons attributeMap overrides _setXXXAttr when _setXXXAttr is a hash/string/array, but _setXXXAttr as a functions override attributeMap.

  • postMixInProperties:

    Called after the parameters to the widget have been read-in, but before the widget template is instantiated. Especially useful to set properties that are referenced in the widget template.

  • startup:

    Processing after the DOM fragment is added to the document

  • destroyRecursive:

    Destroy this widget and its descendants

  • destroy:

    Destroy this widget, but not its descendants. Descendants means widgets inside of this.containerNode. Will also destroy any resources (including widgets) registered via this.own().

    This method will also destroy internal widgets such as those created from a template, assuming those widgets exist inside of this.domNode but outside of this.containerNode.

    For 2.0 it's planned that this method will also destroy descendant widgets, so apps should not depend on the current ability to destroy a widget without destroying its descendants. Generally they should use destroyRecursive() for widgets with children.

  • destroyRendering:

    Destroys the DOM nodes associated with this widget.

  • destroyDescendants:

    Recursively destroy the children of this widget and their descendants.

  • uninitialize:

    Deprecated. Override destroy() instead to implement custom widget tear-down behavior.

  • _setStyleAttr:

    Sets the style attribute of the widget according to value, which is either a hash like {height: "5px", width: "3px"} or a plain string

  • _attrToDom:

    Reflect a widget attribute (title, tabIndex, duration etc.) to the widget DOM, as specified by commands parameter. If commands isn't specified then it's looked up from attributeMap. Note some attributes like "type" cannot be processed this way as they are not mutable.

  • get:

    Get a property from a widget.

  • set:

    Set a property on a widget

  • _attrPairNames
  • _getAttrNames:

    Helper function for get() and set(). Caches attribute name values so we don't do the string ops every time.

  • _set:

    Helper function to set new value for specified property, and call handlers registered with watch() if the value has changed.

  • _get:

    Helper function to get value for specified property stored by this._set(), i.e. for properties with custom setters. Used mainly by custom getters.

    For example, CheckBox._getValueAttr() calls this._get("value").

  • emit:

    Used by widgets to signal that a synthetic event occurred, ex:

    1
    myWidget.emit("attrmodified-selectedChildWidget", {}).

    Emits an event on this.domNode named type.toLowerCase(), based on eventObj. Also calls onType() method, if present, and returns value from that method. By default passes eventObj to callback, but will pass callbackArgs instead, if specified. Modifies eventObj by adding missing parameters (bubbles, cancelable, widget).

  • _onMap:

    Maps on() type parameter (ex: "mousemove") to method name (ex: "onMouseMove"). If type is a synthetic event like touch.press then returns undefined.

  • toString:

    Returns a string that represents the widget.

  • getChildren:

    Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent is this widget. Note that it does not return all descendants, but rather just direct children. Analogous to Node.childNodes, except containing widgets rather than DOMNodes.

    The result intentionally excludes internally created widgets (a.k.a. supporting widgets) outside of this.containerNode.

    Note that the array returned is a simple array. Application code should not assume existence of methods like forEach().

  • getParent:

    Returns the parent widget of this widget.

  • connect:

    Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead.

    Connects specified obj/event to specified method of this object and registers for disconnect() on widget destroy.

    Provide widget-specific analog to dojo.connect, except with the implicit use of this widget as the target object. Events connected with this.connect are disconnected upon destruction.

  • disconnect:

    Deprecated, will be removed in 2.0, use handle.remove() instead.

    Disconnects handle created by connect.

  • subscribe:

    Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead.

    Subscribes to the specified topic and calls the specified method of this object and registers for unsubscribe() on widget destroy.

    Provide widget-specific analog to dojo.subscribe, except with the implicit use of this widget as the target object.

  • unsubscribe:

    Deprecated, will be removed in 2.0, use handle.remove() instead.

    Unsubscribes handle created by this.subscribe. Also removes handle from this widget's list of subscriptions

  • isLeftToRight:

    Return this widget's explicit or implicit orientation (true for LTR, false for RTL)

  • isFocusable:

    Return true if this widget can currently be focused and false if not

  • placeAt:

    Place this widget somewhere in the DOM based on standard domConstruct.place() conventions.

  • defer:

    Wrapper to setTimeout to avoid deferred functions executing after the originating widget has been destroyed. Returns an object handle with a remove method (that returns null) (replaces clearTimeout).

  • _changeAttrValue:

    Internal helper for directly changing an attribute value.

  • watch:

    Watches a property for changes

  • own:

    Track specified handles and remove/destroy them when this instance is destroyed, unless they were already removed/destroyed manually.

  • focused (Boolean):

    This widget or a widget it contains has focus, or is "active" because it was recently clicked.

  • onFocus:

    Called when the widget becomes "active" because it or a widget inside of it either has focus, or has recently been clicked.

  • onBlur:

    Called when the widget stops being "active" because focus moved to something outside of it, or the user clicked somewhere outside of it, or the widget was hidden.

  • _onFocus:

    This is where widgets do processing for when they are active, such as changing CSS classes. See onFocus() for more details.

  • _onBlur:

    This is where widgets do processing for when they stop being active, such as changing CSS classes. See onBlur() for more details.

  • _focusManager
  • templatePath (String):

    Path to template (HTML file) for this widget relative to dojo.baseUrl. Deprecated: use templateString with require([... "dojo/text!..."], ...) instead

  • _skipNodeCache
  • _rendered (Boolean):

    Not normally use, but this flag can be set by the app if the server has already rendered the template, i.e. already inlining the template for the widget into the main page. Reduces _TemplatedMixin to just function like _AttachMixin.

  • searchContainerNode
  • _stringRepl:

    Does substitution of ${foo} type properties in template string

  • _escapeValue:

    Escape a value to be inserted into the template, either into an attribute value (ex: foo="${bar}") or as inner text of an element (ex: ${foo})

  • _fillContent:

    Relocate source contents to templated container node. this.containerNode must be able to receive children, or exceptions will be thrown.

  • _attachPoints (String[]):

    List of widget attribute names associated with data-dojo-attach-point=... in the template, ex: ["containerNode", "labelNode"]

  • _attachEvents (Handle[]):

    List of connections associated with data-dojo-attach-event=... in the template

  • attachScope (Object):

    Object to which attach points and events will be scoped. Defaults to 'this'.

  • _beforeFillContent
  • _attachTemplateNodes:

    Iterate through the dom nodes and attach functions and nodes accordingly.

  • _processTemplateNode:

    Process data-dojo-attach-point and data-dojo-attach-event for given node or widget. Returns true if caller should process baseNode's children too.

  • _attach:

    Roughly corresponding to dojo/on, this is the default function for processing a data-dojo-attach-event. Meant to attach to DOMNodes, not to widgets.

  • _detachTemplateNodes:

    Detach and clean up the attachments made in _attachtempalteNodes.

  • addChild:

    Makes the given widget a child of this widget.

  • hasChildren:

    Returns true if widget has child widgets, i.e. if this.containerNode contains widgets.

  • _getSiblingOfChild:

    Get the next or previous widget sibling of child

  • getIndexOfChild:

    Gets the index of the child in this container or -1 if not found

  • _getSibling:

    Returns next or previous sibling

  • getPreviousSibling:

    Returns null if this is the first child of the parent, otherwise returns the next element sibling to the "left".

  • getNextSibling:

    Returns null if this is the last child of the parent, otherwise returns the next element sibling to the "right".

  • getIndexInParent:

    Returns the index of this widget within its container parent. It returns -1 if the parent does not exist, or if the parent is not a dijit/_Container

  • hovering (Boolean):

    True if cursor is over this widget

  • active (Boolean):

    True if mouse was pressed while over this widget, and hasn't been released yet

  • _cssMouseEvent:

    Handler for CSS event on this.domNode. Sets hovering and active properties depending on mouse state, which triggers _setStateClass() to set appropriate CSS classes for this.domNode.

  • _setStateClass:

    Update the visual state of the widget by setting the css classes on this.domNode (or this.stateNode if defined) by combining this.baseClass with various suffixes that represent the current widget state(s).

  • _subnodeCssMouseEvent:

    Handler for hover/active mouse event on widget's subnode

  • _trackMouseState:

    Track mouse/focus events on specified node and set CSS class on that node to indicate current state. Usually not called directly, but via cssStateNodes attribute.

e Event

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
_onContainerFocus(evt)
Defined by: dijit/_KeyNavMixin

Handler for when the container itself gets focus.

Initially the container itself has a tabIndex, but when it gets focus, switch focus to first child.

TODO for 2.0 (or earlier): Instead of having the container tabbable, always maintain a single child widget as tabbable, Requires code in startup(), addChild(), and removeChild(). That would avoid various issues like #17347.

Parameter Type Description
evt undefined

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
_onContainerKeydown(evt)
Defined by: dijit/_KeyNavMixin

When a key is pressed, if it's an arrow key etc. then it's handled here.

Parameter Type Description
evt undefined

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
_onContainerKeypress(evt)
Defined by: dijit/_KeyNavMixin

When a printable key is pressed, it's handled here, searching by letter.

Parameter Type Description
evt undefined

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
_onDblClick(nodeWidget,e)
Defined by: dijit/Tree

Translates double-click events into commands for the controller to process

Parameter Type Description
nodeWidget Object

An object with the following properties:

  • item (Item):

    the dojo.data entry this tree represents

  • isTreeNode (Boolean):

    Indicates that this is a TreeNode. Used by dijit.Tree only, should not be accessed directly.

  • label (String):

    Text of this tree node

  • _setLabelAttr
  • labelType (String):

    Specifies how to interpret the label. Can be "html" or "text".

  • isExpandable (Boolean):

    This node has children, so show the expando node (+ sign)

  • isExpanded (Boolean):

    This node is currently expanded (ie, opened)

  • state (String):

    Dynamic loading-related stuff. When an empty folder node appears, it is "NotLoaded" first, then after dojo.data query it becomes "Loading" and, finally "Loaded"

  • templateString
  • baseClass
  • cssStateNodes
  • _setTooltipAttr
  • buildRendering
  • _setIndentAttr:

    Tell this node how many levels it should be indented

  • markProcessing:

    Visually denote that tree is loading data, etc.

  • unmarkProcessing:

    Clear markup from markProcessing() call

  • _updateItemClasses:

    Set appropriate CSS classes for icon and label dom node (used to allow for item updates to change respective CSS)

  • _applyClassAndStyle:

    Set the appropriate CSS classes and styles for labels, icons and rows.

  • _updateLayout:

    Set appropriate CSS classes for this.domNode

  • _setExpando:

    Set the right image for the expando node

  • expand:

    Show my children

  • collapse:

    Collapse this node (if it's expanded)

  • indent (Integer):

    Levels from this node to the root node

  • setChildItems:

    Sets the child items of this node, removing/adding nodes from current children to match specified items[] array. Also, if this.persist == true, expands any children that were previously opened.

  • getTreePath
  • getIdentity
  • removeChild
  • makeExpandable:

    if this node wasn't already showing the expando node, turn it into one and call _setExpando()

  • setSelected:

    A Tree has a (single) currently selected node. Mark that this node is/isn't that currently selected node.

  • focus
  • onClick:

    Connect to this function to receive notifications of mouse click events.

  • onDblClick:

    Connect to this function to receive notifications of mouse double click events.

  • onKeyDown:

    Connect to this function to receive notifications of keys being pressed down.

  • onKeyPress:

    Connect to this function to receive notifications of printable keys being typed.

  • onKeyUp:

    Connect to this function to receive notifications of keys being released.

  • onMouseDown:

    Connect to this function to receive notifications of when the mouse button is pressed down.

  • onMouseMove:

    Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget.

  • onMouseOut:

    Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget.

  • onMouseOver:

    Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget.

  • onMouseLeave:

    Connect to this function to receive notifications of when the mouse moves off of this widget.

  • onMouseEnter:

    Connect to this function to receive notifications of when the mouse moves onto this widget.

  • onMouseUp:

    Connect to this function to receive notifications of when the mouse button is released.

  • postCreate
  • on
  • _setFocusedAttr
  • setAttribute:

    Deprecated. Use set() instead.

  • attr:

    This method is deprecated, use get() or set() directly.

  • getDescendants:

    Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode. This method should generally be avoided as it returns widgets declared in templates, which are supposed to be internal/hidden, but it's left here for back-compat reasons.

  • _onShow:

    Internal method called when this widget is made visible. See onShow for details.

  • onShow:

    Called when this widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.

    Also called to indicate display of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane.

  • onHide:

    Called when another widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.

    Also called to indicate hide of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane.

  • onClose:

    Called when this widget is being displayed as a popup (ex: a Calendar popped up from a DateTextBox), and it is hidden. This is called from the dijit.popup code, and should not be called directly.

    Also used as a parameter for children of dijit/layout/StackContainer or subclasses. Callback if a user tries to close the child. Child will be closed if this function returns true.

  • id (String):

    A unique, opaque ID string that can be assigned by users or by the system. If the developer passes an ID which is known not to be unique, the specified ID is ignored and the system-generated ID is used instead.

  • _setIdAttr
  • lang (String):

    Rarely used. Overrides the default Dojo locale used to render this widget, as defined by the HTML LANG attribute. Value must be among the list of locales specified during by the Dojo bootstrap, formatted according to RFC 3066 (like en-us).

  • _setLangAttr
  • dir (String):

    Bi-directional support, as defined by the HTML DIR attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's default direction.

  • _setDirAttr
  • class
  • _setClassAttr
  • _setTypeAttr
  • style (String||Object):

    HTML style attributes as cssText string or name/value hash

  • title (String):

    HTML title attribute.

    For form widgets this specifies a tooltip to display when hovering over the widget (just like the native HTML title attribute).

    For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer, etc., it's used to specify the tab label, accordion pane title, etc. In this case it's interpreted as HTML.

  • tooltip (String):

    When this widget's title attribute is used to for a tab label, accordion pane title, etc., this specifies the tooltip to appear when the mouse is hovered over that text.

  • srcNodeRef (DomNode):

    pointer to original DOM node

  • domNode (DomNode):

    This is our visible representation of the widget! Other DOM Nodes may by assigned to other properties, usually through the template system's data-dojo-attach-point syntax, but the domNode property is the canonical "top level" node in widget UI.

  • containerNode (DomNode):

    Designates where children of the source DOM node will be placed. "Children" in this case refers to both DOM nodes and widgets. For example, for myWidget:

    1
    2
    3
    4
    5
    <div data-dojo-type=myWidget>
        <b> here's a plain DOM node
        <span data-dojo-type=subWidget>and a widget</span>
        <i> and another plain DOM node </i>
    </div>

    containerNode would point to:

    1
    2
    3
    <b> here's a plain DOM node
    <span data-dojo-type=subWidget>and a widget</span>
    <i> and another plain DOM node </i>

    In templated widgets, "containerNode" is set via a data-dojo-attach-point assignment.

    containerNode must be defined for any widget that accepts innerHTML (like ContentPane or BorderContainer or even Button), and conversely is null for widgets that don't, like TextBox.

  • ownerDocument (Document?, optional):

    The document this widget belongs to. If not specified to constructor, will default to srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global

  • _setOwnerDocumentAttr
  • _started (Boolean):

    startup() has completed.

  • attributeMap (Object):

    Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute for each XXX attribute to be mapped to the DOM.

    attributeMap sets up a "binding" between attributes (aka properties) of the widget and the widget's DOM. Changes to widget attributes listed in attributeMap will be reflected into the DOM.

    For example, calling set('title', 'hello') on a TitlePane will automatically cause the TitlePane's DOM to update with the new title.

    attributeMap is a hash where the key is an attribute of the widget, and the value reflects a binding to a:

    • DOM node attribute

      focus: {node: "focusNode", type: "attribute"} Maps this.focus to this.focusNode.focus

    • DOM node innerHTML

      title: { node: "titleNode", type: "innerHTML" } Maps this.title to this.titleNode.innerHTML

    • DOM node innerText

      title: { node: "titleNode", type: "innerText" } Maps this.title to this.titleNode.innerText

    • DOM node CSS class

      myClass: { node: "domNode", type: "class" } Maps this.myClass to this.domNode.className

    If the value is an array, then each element in the array matches one of the formats of the above list.

    There are also some shorthands for backwards compatibility:

    • string --> { node: string, type: "attribute" }, for example:
    1
    "focusNode" ---> { node: "focusNode", type: "attribute" }
    • "" --> { node: "domNode", type: "attribute" }
  • _blankGif (String):

    Path to a blank 1x1 image. Used by <img> nodes in templates that really get their image via CSS background-image.

  • _introspect:

    Collect metadata about this widget (only once per class, not once per instance):

    1
    2
    - list of attributes with custom setters, storing in this.constructor._setterAttrs
    - generate this.constructor._onMap, mapping names like "mousedown" to functions like onMouseDown
  • postscript:

    Kicks off widget instantiation. See create() for details.

  • create:

    Kick off the life-cycle of a widget

  • _applyAttributes:

    Step during widget creation to copy widget attributes to the DOM according to attributeMap and _setXXXAttr objects, and also to call custom _setXXXAttr() methods.

    Skips over blank/false attribute values, unless they were explicitly specified as parameters to the widget, since those are the default anyway, and setting tabIndex="" is different than not setting tabIndex at all.

    For backwards-compatibility reasons attributeMap overrides _setXXXAttr when _setXXXAttr is a hash/string/array, but _setXXXAttr as a functions override attributeMap.

  • postMixInProperties:

    Called after the parameters to the widget have been read-in, but before the widget template is instantiated. Especially useful to set properties that are referenced in the widget template.

  • startup:

    Processing after the DOM fragment is added to the document

  • destroyRecursive:

    Destroy this widget and its descendants

  • destroy:

    Destroy this widget, but not its descendants. Descendants means widgets inside of this.containerNode. Will also destroy any resources (including widgets) registered via this.own().

    This method will also destroy internal widgets such as those created from a template, assuming those widgets exist inside of this.domNode but outside of this.containerNode.

    For 2.0 it's planned that this method will also destroy descendant widgets, so apps should not depend on the current ability to destroy a widget without destroying its descendants. Generally they should use destroyRecursive() for widgets with children.

  • destroyRendering:

    Destroys the DOM nodes associated with this widget.

  • destroyDescendants:

    Recursively destroy the children of this widget and their descendants.

  • uninitialize:

    Deprecated. Override destroy() instead to implement custom widget tear-down behavior.

  • _setStyleAttr:

    Sets the style attribute of the widget according to value, which is either a hash like {height: "5px", width: "3px"} or a plain string

  • _attrToDom:

    Reflect a widget attribute (title, tabIndex, duration etc.) to the widget DOM, as specified by commands parameter. If commands isn't specified then it's looked up from attributeMap. Note some attributes like "type" cannot be processed this way as they are not mutable.

  • get:

    Get a property from a widget.

  • set:

    Set a property on a widget

  • _attrPairNames
  • _getAttrNames:

    Helper function for get() and set(). Caches attribute name values so we don't do the string ops every time.

  • _set:

    Helper function to set new value for specified property, and call handlers registered with watch() if the value has changed.

  • _get:

    Helper function to get value for specified property stored by this._set(), i.e. for properties with custom setters. Used mainly by custom getters.

    For example, CheckBox._getValueAttr() calls this._get("value").

  • emit:

    Used by widgets to signal that a synthetic event occurred, ex:

    1
    myWidget.emit("attrmodified-selectedChildWidget", {}).

    Emits an event on this.domNode named type.toLowerCase(), based on eventObj. Also calls onType() method, if present, and returns value from that method. By default passes eventObj to callback, but will pass callbackArgs instead, if specified. Modifies eventObj by adding missing parameters (bubbles, cancelable, widget).

  • _onMap:

    Maps on() type parameter (ex: "mousemove") to method name (ex: "onMouseMove"). If type is a synthetic event like touch.press then returns undefined.

  • toString:

    Returns a string that represents the widget.

  • getChildren:

    Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent is this widget. Note that it does not return all descendants, but rather just direct children. Analogous to Node.childNodes, except containing widgets rather than DOMNodes.

    The result intentionally excludes internally created widgets (a.k.a. supporting widgets) outside of this.containerNode.

    Note that the array returned is a simple array. Application code should not assume existence of methods like forEach().

  • getParent:

    Returns the parent widget of this widget.

  • connect:

    Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead.

    Connects specified obj/event to specified method of this object and registers for disconnect() on widget destroy.

    Provide widget-specific analog to dojo.connect, except with the implicit use of this widget as the target object. Events connected with this.connect are disconnected upon destruction.

  • disconnect:

    Deprecated, will be removed in 2.0, use handle.remove() instead.

    Disconnects handle created by connect.

  • subscribe:

    Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead.

    Subscribes to the specified topic and calls the specified method of this object and registers for unsubscribe() on widget destroy.

    Provide widget-specific analog to dojo.subscribe, except with the implicit use of this widget as the target object.

  • unsubscribe:

    Deprecated, will be removed in 2.0, use handle.remove() instead.

    Unsubscribes handle created by this.subscribe. Also removes handle from this widget's list of subscriptions

  • isLeftToRight:

    Return this widget's explicit or implicit orientation (true for LTR, false for RTL)

  • isFocusable:

    Return true if this widget can currently be focused and false if not

  • placeAt:

    Place this widget somewhere in the DOM based on standard domConstruct.place() conventions.

  • defer:

    Wrapper to setTimeout to avoid deferred functions executing after the originating widget has been destroyed. Returns an object handle with a remove method (that returns null) (replaces clearTimeout).

  • _changeAttrValue:

    Internal helper for directly changing an attribute value.

  • watch:

    Watches a property for changes

  • own:

    Track specified handles and remove/destroy them when this instance is destroyed, unless they were already removed/destroyed manually.

  • focused (Boolean):

    This widget or a widget it contains has focus, or is "active" because it was recently clicked.

  • onFocus:

    Called when the widget becomes "active" because it or a widget inside of it either has focus, or has recently been clicked.

  • onBlur:

    Called when the widget stops being "active" because focus moved to something outside of it, or the user clicked somewhere outside of it, or the widget was hidden.

  • _onFocus:

    This is where widgets do processing for when they are active, such as changing CSS classes. See onFocus() for more details.

  • _onBlur:

    This is where widgets do processing for when they stop being active, such as changing CSS classes. See onBlur() for more details.

  • _focusManager
  • templatePath (String):

    Path to template (HTML file) for this widget relative to dojo.baseUrl. Deprecated: use templateString with require([... "dojo/text!..."], ...) instead

  • _skipNodeCache
  • _rendered (Boolean):

    Not normally use, but this flag can be set by the app if the server has already rendered the template, i.e. already inlining the template for the widget into the main page. Reduces _TemplatedMixin to just function like _AttachMixin.

  • searchContainerNode
  • _stringRepl:

    Does substitution of ${foo} type properties in template string

  • _escapeValue:

    Escape a value to be inserted into the template, either into an attribute value (ex: foo="${bar}") or as inner text of an element (ex: ${foo})

  • _fillContent:

    Relocate source contents to templated container node. this.containerNode must be able to receive children, or exceptions will be thrown.

  • _attachPoints (String[]):

    List of widget attribute names associated with data-dojo-attach-point=... in the template, ex: ["containerNode", "labelNode"]

  • _attachEvents (Handle[]):

    List of connections associated with data-dojo-attach-event=... in the template

  • attachScope (Object):

    Object to which attach points and events will be scoped. Defaults to 'this'.

  • _beforeFillContent
  • _attachTemplateNodes:

    Iterate through the dom nodes and attach functions and nodes accordingly.

  • _processTemplateNode:

    Process data-dojo-attach-point and data-dojo-attach-event for given node or widget. Returns true if caller should process baseNode's children too.

  • _attach:

    Roughly corresponding to dojo/on, this is the default function for processing a data-dojo-attach-event. Meant to attach to DOMNodes, not to widgets.

  • _detachTemplateNodes:

    Detach and clean up the attachments made in _attachtempalteNodes.

  • addChild:

    Makes the given widget a child of this widget.

  • hasChildren:

    Returns true if widget has child widgets, i.e. if this.containerNode contains widgets.

  • _getSiblingOfChild:

    Get the next or previous widget sibling of child

  • getIndexOfChild:

    Gets the index of the child in this container or -1 if not found

  • _getSibling:

    Returns next or previous sibling

  • getPreviousSibling:

    Returns null if this is the first child of the parent, otherwise returns the next element sibling to the "left".

  • getNextSibling:

    Returns null if this is the last child of the parent, otherwise returns the next element sibling to the "right".

  • getIndexInParent:

    Returns the index of this widget within its container parent. It returns -1 if the parent does not exist, or if the parent is not a dijit/_Container

  • hovering (Boolean):

    True if cursor is over this widget

  • active (Boolean):

    True if mouse was pressed while over this widget, and hasn't been released yet

  • _cssMouseEvent:

    Handler for CSS event on this.domNode. Sets hovering and active properties depending on mouse state, which triggers _setStateClass() to set appropriate CSS classes for this.domNode.

  • _setStateClass:

    Update the visual state of the widget by setting the css classes on this.domNode (or this.stateNode if defined) by combining this.baseClass with various suffixes that represent the current widget state(s).

  • _subnodeCssMouseEvent:

    Handler for hover/active mouse event on widget's subnode

  • _trackMouseState:

    Track mouse/focus events on specified node and set CSS class on that node to indicate current state. Usually not called directly, but via cssStateNodes attribute.

e Event

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
_onDownArrow(evt,node)
Defined by: dijit/Tree

down arrow pressed; get next visible node, set focus there

Parameter Type Description
evt Event
node Object

An object with the following properties:

  • item (Item):

    the dojo.data entry this tree represents

  • isTreeNode (Boolean):

    Indicates that this is a TreeNode. Used by dijit.Tree only, should not be accessed directly.

  • label (String):

    Text of this tree node

  • _setLabelAttr
  • labelType (String):

    Specifies how to interpret the label. Can be "html" or "text".

  • isExpandable (Boolean):

    This node has children, so show the expando node (+ sign)

  • isExpanded (Boolean):

    This node is currently expanded (ie, opened)

  • state (String):

    Dynamic loading-related stuff. When an empty folder node appears, it is "NotLoaded" first, then after dojo.data query it becomes "Loading" and, finally "Loaded"

  • templateString
  • baseClass
  • cssStateNodes
  • _setTooltipAttr
  • buildRendering
  • _setIndentAttr:

    Tell this node how many levels it should be indented

  • markProcessing:

    Visually denote that tree is loading data, etc.

  • unmarkProcessing:

    Clear markup from markProcessing() call

  • _updateItemClasses:

    Set appropriate CSS classes for icon and label dom node (used to allow for item updates to change respective CSS)

  • _applyClassAndStyle:

    Set the appropriate CSS classes and styles for labels, icons and rows.

  • _updateLayout:

    Set appropriate CSS classes for this.domNode

  • _setExpando:

    Set the right image for the expando node

  • expand:

    Show my children

  • collapse:

    Collapse this node (if it's expanded)

  • indent (Integer):

    Levels from this node to the root node

  • setChildItems:

    Sets the child items of this node, removing/adding nodes from current children to match specified items[] array. Also, if this.persist == true, expands any children that were previously opened.

  • getTreePath
  • getIdentity
  • removeChild
  • makeExpandable:

    if this node wasn't already showing the expando node, turn it into one and call _setExpando()

  • setSelected:

    A Tree has a (single) currently selected node. Mark that this node is/isn't that currently selected node.

  • focus
  • onClick:

    Connect to this function to receive notifications of mouse click events.

  • onDblClick:

    Connect to this function to receive notifications of mouse double click events.

  • onKeyDown:

    Connect to this function to receive notifications of keys being pressed down.

  • onKeyPress:

    Connect to this function to receive notifications of printable keys being typed.

  • onKeyUp:

    Connect to this function to receive notifications of keys being released.

  • onMouseDown:

    Connect to this function to receive notifications of when the mouse button is pressed down.

  • onMouseMove:

    Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget.

  • onMouseOut:

    Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget.

  • onMouseOver:

    Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget.

  • onMouseLeave:

    Connect to this function to receive notifications of when the mouse moves off of this widget.

  • onMouseEnter:

    Connect to this function to receive notifications of when the mouse moves onto this widget.

  • onMouseUp:

    Connect to this function to receive notifications of when the mouse button is released.

  • postCreate
  • on
  • _setFocusedAttr
  • setAttribute:

    Deprecated. Use set() instead.

  • attr:

    This method is deprecated, use get() or set() directly.

  • getDescendants:

    Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode. This method should generally be avoided as it returns widgets declared in templates, which are supposed to be internal/hidden, but it's left here for back-compat reasons.

  • _onShow:

    Internal method called when this widget is made visible. See onShow for details.

  • onShow:

    Called when this widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.

    Also called to indicate display of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane.

  • onHide:

    Called when another widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.

    Also called to indicate hide of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane.

  • onClose:

    Called when this widget is being displayed as a popup (ex: a Calendar popped up from a DateTextBox), and it is hidden. This is called from the dijit.popup code, and should not be called directly.

    Also used as a parameter for children of dijit/layout/StackContainer or subclasses. Callback if a user tries to close the child. Child will be closed if this function returns true.

  • id (String):

    A unique, opaque ID string that can be assigned by users or by the system. If the developer passes an ID which is known not to be unique, the specified ID is ignored and the system-generated ID is used instead.

  • _setIdAttr
  • lang (String):

    Rarely used. Overrides the default Dojo locale used to render this widget, as defined by the HTML LANG attribute. Value must be among the list of locales specified during by the Dojo bootstrap, formatted according to RFC 3066 (like en-us).

  • _setLangAttr
  • dir (String):

    Bi-directional support, as defined by the HTML DIR attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's default direction.

  • _setDirAttr
  • class
  • _setClassAttr
  • _setTypeAttr
  • style (String||Object):

    HTML style attributes as cssText string or name/value hash

  • title (String):

    HTML title attribute.

    For form widgets this specifies a tooltip to display when hovering over the widget (just like the native HTML title attribute).

    For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer, etc., it's used to specify the tab label, accordion pane title, etc. In this case it's interpreted as HTML.

  • tooltip (String):

    When this widget's title attribute is used to for a tab label, accordion pane title, etc., this specifies the tooltip to appear when the mouse is hovered over that text.

  • srcNodeRef (DomNode):

    pointer to original DOM node

  • domNode (DomNode):

    This is our visible representation of the widget! Other DOM Nodes may by assigned to other properties, usually through the template system's data-dojo-attach-point syntax, but the domNode property is the canonical "top level" node in widget UI.

  • containerNode (DomNode):

    Designates where children of the source DOM node will be placed. "Children" in this case refers to both DOM nodes and widgets. For example, for myWidget:

    1
    2
    3
    4
    5
    <div data-dojo-type=myWidget>
        <b> here's a plain DOM node
        <span data-dojo-type=subWidget>and a widget</span>
        <i> and another plain DOM node </i>
    </div>

    containerNode would point to:

    1
    2
    3
    <b> here's a plain DOM node
    <span data-dojo-type=subWidget>and a widget</span>
    <i> and another plain DOM node </i>

    In templated widgets, "containerNode" is set via a data-dojo-attach-point assignment.

    containerNode must be defined for any widget that accepts innerHTML (like ContentPane or BorderContainer or even Button), and conversely is null for widgets that don't, like TextBox.

  • ownerDocument (Document?, optional):

    The document this widget belongs to. If not specified to constructor, will default to srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global

  • _setOwnerDocumentAttr
  • _started (Boolean):

    startup() has completed.

  • attributeMap (Object):

    Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute for each XXX attribute to be mapped to the DOM.

    attributeMap sets up a "binding" between attributes (aka properties) of the widget and the widget's DOM. Changes to widget attributes listed in attributeMap will be reflected into the DOM.

    For example, calling set('title', 'hello') on a TitlePane will automatically cause the TitlePane's DOM to update with the new title.

    attributeMap is a hash where the key is an attribute of the widget, and the value reflects a binding to a:

    • DOM node attribute

      focus: {node: "focusNode", type: "attribute"} Maps this.focus to this.focusNode.focus

    • DOM node innerHTML

      title: { node: "titleNode", type: "innerHTML" } Maps this.title to this.titleNode.innerHTML

    • DOM node innerText

      title: { node: "titleNode", type: "innerText" } Maps this.title to this.titleNode.innerText

    • DOM node CSS class

      myClass: { node: "domNode", type: "class" } Maps this.myClass to this.domNode.className

    If the value is an array, then each element in the array matches one of the formats of the above list.

    There are also some shorthands for backwards compatibility:

    • string --> { node: string, type: "attribute" }, for example:
    1
    "focusNode" ---> { node: "focusNode", type: "attribute" }
    • "" --> { node: "domNode", type: "attribute" }
  • _blankGif (String):

    Path to a blank 1x1 image. Used by <img> nodes in templates that really get their image via CSS background-image.

  • _introspect:

    Collect metadata about this widget (only once per class, not once per instance):

    1
    2
    - list of attributes with custom setters, storing in this.constructor._setterAttrs
    - generate this.constructor._onMap, mapping names like "mousedown" to functions like onMouseDown
  • postscript:

    Kicks off widget instantiation. See create() for details.

  • create:

    Kick off the life-cycle of a widget

  • _applyAttributes:

    Step during widget creation to copy widget attributes to the DOM according to attributeMap and _setXXXAttr objects, and also to call custom _setXXXAttr() methods.

    Skips over blank/false attribute values, unless they were explicitly specified as parameters to the widget, since those are the default anyway, and setting tabIndex="" is different than not setting tabIndex at all.

    For backwards-compatibility reasons attributeMap overrides _setXXXAttr when _setXXXAttr is a hash/string/array, but _setXXXAttr as a functions override attributeMap.

  • postMixInProperties:

    Called after the parameters to the widget have been read-in, but before the widget template is instantiated. Especially useful to set properties that are referenced in the widget template.

  • startup:

    Processing after the DOM fragment is added to the document

  • destroyRecursive:

    Destroy this widget and its descendants

  • destroy:

    Destroy this widget, but not its descendants. Descendants means widgets inside of this.containerNode. Will also destroy any resources (including widgets) registered via this.own().

    This method will also destroy internal widgets such as those created from a template, assuming those widgets exist inside of this.domNode but outside of this.containerNode.

    For 2.0 it's planned that this method will also destroy descendant widgets, so apps should not depend on the current ability to destroy a widget without destroying its descendants. Generally they should use destroyRecursive() for widgets with children.

  • destroyRendering:

    Destroys the DOM nodes associated with this widget.

  • destroyDescendants:

    Recursively destroy the children of this widget and their descendants.

  • uninitialize:

    Deprecated. Override destroy() instead to implement custom widget tear-down behavior.

  • _setStyleAttr:

    Sets the style attribute of the widget according to value, which is either a hash like {height: "5px", width: "3px"} or a plain string

  • _attrToDom:

    Reflect a widget attribute (title, tabIndex, duration etc.) to the widget DOM, as specified by commands parameter. If commands isn't specified then it's looked up from attributeMap. Note some attributes like "type" cannot be processed this way as they are not mutable.

  • get:

    Get a property from a widget.

  • set:

    Set a property on a widget

  • _attrPairNames
  • _getAttrNames:

    Helper function for get() and set(). Caches attribute name values so we don't do the string ops every time.

  • _set:

    Helper function to set new value for specified property, and call handlers registered with watch() if the value has changed.

  • _get:

    Helper function to get value for specified property stored by this._set(), i.e. for properties with custom setters. Used mainly by custom getters.

    For example, CheckBox._getValueAttr() calls this._get("value").

  • emit:

    Used by widgets to signal that a synthetic event occurred, ex:

    1
    myWidget.emit("attrmodified-selectedChildWidget", {}).

    Emits an event on this.domNode named type.toLowerCase(), based on eventObj. Also calls onType() method, if present, and returns value from that method. By default passes eventObj to callback, but will pass callbackArgs instead, if specified. Modifies eventObj by adding missing parameters (bubbles, cancelable, widget).

  • _onMap:

    Maps on() type parameter (ex: "mousemove") to method name (ex: "onMouseMove"). If type is a synthetic event like touch.press then returns undefined.

  • toString:

    Returns a string that represents the widget.

  • getChildren:

    Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent is this widget. Note that it does not return all descendants, but rather just direct children. Analogous to Node.childNodes, except containing widgets rather than DOMNodes.

    The result intentionally excludes internally created widgets (a.k.a. supporting widgets) outside of this.containerNode.

    Note that the array returned is a simple array. Application code should not assume existence of methods like forEach().

  • getParent:

    Returns the parent widget of this widget.

  • connect:

    Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead.

    Connects specified obj/event to specified method of this object and registers for disconnect() on widget destroy.

    Provide widget-specific analog to dojo.connect, except with the implicit use of this widget as the target object. Events connected with this.connect are disconnected upon destruction.

  • disconnect:

    Deprecated, will be removed in 2.0, use handle.remove() instead.

    Disconnects handle created by connect.

  • subscribe:

    Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead.

    Subscribes to the specified topic and calls the specified method of this object and registers for unsubscribe() on widget destroy.

    Provide widget-specific analog to dojo.subscribe, except with the implicit use of this widget as the target object.

  • unsubscribe:

    Deprecated, will be removed in 2.0, use handle.remove() instead.

    Unsubscribes handle created by this.subscribe. Also removes handle from this widget's list of subscriptions

  • isLeftToRight:

    Return this widget's explicit or implicit orientation (true for LTR, false for RTL)

  • isFocusable:

    Return true if this widget can currently be focused and false if not

  • placeAt:

    Place this widget somewhere in the DOM based on standard domConstruct.place() conventions.

  • defer:

    Wrapper to setTimeout to avoid deferred functions executing after the originating widget has been destroyed. Returns an object handle with a remove method (that returns null) (replaces clearTimeout).

  • _changeAttrValue:

    Internal helper for directly changing an attribute value.

  • watch:

    Watches a property for changes

  • own:

    Track specified handles and remove/destroy them when this instance is destroyed, unless they were already removed/destroyed manually.

  • focused (Boolean):

    This widget or a widget it contains has focus, or is "active" because it was recently clicked.

  • onFocus:

    Called when the widget becomes "active" because it or a widget inside of it either has focus, or has recently been clicked.

  • onBlur:

    Called when the widget stops being "active" because focus moved to something outside of it, or the user clicked somewhere outside of it, or the widget was hidden.

  • _onFocus:

    This is where widgets do processing for when they are active, such as changing CSS classes. See onFocus() for more details.

  • _onBlur:

    This is where widgets do processing for when they stop being active, such as changing CSS classes. See onBlur() for more details.

  • _focusManager
  • templatePath (String):

    Path to template (HTML file) for this widget relative to dojo.baseUrl. Deprecated: use templateString with require([... "dojo/text!..."], ...) instead

  • _skipNodeCache
  • _rendered (Boolean):

    Not normally use, but this flag can be set by the app if the server has already rendered the template, i.e. already inlining the template for the widget into the main page. Reduces _TemplatedMixin to just function like _AttachMixin.

  • searchContainerNode
  • _stringRepl:

    Does substitution of ${foo} type properties in template string

  • _escapeValue:

    Escape a value to be inserted into the template, either into an attribute value (ex: foo="${bar}") or as inner text of an element (ex: ${foo})

  • _fillContent:

    Relocate source contents to templated container node. this.containerNode must be able to receive children, or exceptions will be thrown.

  • _attachPoints (String[]):

    List of widget attribute names associated with data-dojo-attach-point=... in the template, ex: ["containerNode", "labelNode"]

  • _attachEvents (Handle[]):

    List of connections associated with data-dojo-attach-event=... in the template

  • attachScope (Object):

    Object to which attach points and events will be scoped. Defaults to 'this'.

  • _beforeFillContent
  • _attachTemplateNodes:

    Iterate through the dom nodes and attach functions and nodes accordingly.

  • _processTemplateNode:

    Process data-dojo-attach-point and data-dojo-attach-event for given node or widget. Returns true if caller should process baseNode's children too.

  • _attach:

    Roughly corresponding to dojo/on, this is the default function for processing a data-dojo-attach-event. Meant to attach to DOMNodes, not to widgets.

  • _detachTemplateNodes:

    Detach and clean up the attachments made in _attachtempalteNodes.

  • addChild:

    Makes the given widget a child of this widget.

  • hasChildren:

    Returns true if widget has child widgets, i.e. if this.containerNode contains widgets.

  • _getSiblingOfChild:

    Get the next or previous widget sibling of child

  • getIndexOfChild:

    Gets the index of the child in this container or -1 if not found

  • _getSibling:

    Returns next or previous sibling

  • getPreviousSibling:

    Returns null if this is the first child of the parent, otherwise returns the next element sibling to the "left".

  • getNextSibling:

    Returns null if this is the last child of the parent, otherwise returns the next element sibling to the "right".

  • getIndexInParent:

    Returns the index of this widget within its container parent. It returns -1 if the parent does not exist, or if the parent is not a dijit/_Container

  • hovering (Boolean):

    True if cursor is over this widget

  • active (Boolean):

    True if mouse was pressed while over this widget, and hasn't been released yet

  • _cssMouseEvent:

    Handler for CSS event on this.domNode. Sets hovering and active properties depending on mouse state, which triggers _setStateClass() to set appropriate CSS classes for this.domNode.

  • _setStateClass:

    Update the visual state of the widget by setting the css classes on this.domNode (or this.stateNode if defined) by combining this.baseClass with various suffixes that represent the current widget state(s).

  • _subnodeCssMouseEvent:

    Handler for hover/active mouse event on widget's subnode

  • _trackMouseState:

    Track mouse/focus events on specified node and set CSS class on that node to indicate current state. Usually not called directly, but via cssStateNodes attribute.

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
_onExpandoClick(message)
Defined by: dijit/Tree

User clicked the +/- icon; expand or collapse my children.

Parameter Type Description
message Object

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
_onFocus()
Defined by: dijit/_FocusMixin

This is where widgets do processing for when they are active, such as changing CSS classes. See onFocus() for more details.

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
_onItemChange(item)
Defined by: dijit/Tree

Processes notification of a change to an item's scalar values like label

Parameter Type Description
item Item

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
_onItemChildrenChange(parent,newChildrenList)
Defined by: dijit/Tree

Processes notification of a change to an item's children

Parameter Type Description
parent dojo/data/Item
newChildrenList dojo/data/Item[]

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
_onItemDelete(item)
Defined by: dijit/Tree

Processes notification of a deletion of an item. Not called from new dojo.store interface but there's cleanup code in setChildItems() instead.

Parameter Type Description
item Item

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
_onLeftArrow(evt,node)
Defined by: dijit/Tree

Left arrow pressed. If not collapsed, collapse, else move to parent.

Parameter Type Description
evt Event
node Object

An object with the following properties:

  • item (Item):

    the dojo.data entry this tree represents

  • isTreeNode (Boolean):

    Indicates that this is a TreeNode. Used by dijit.Tree only, should not be accessed directly.

  • label (String):

    Text of this tree node

  • _setLabelAttr
  • labelType (String):

    Specifies how to interpret the label. Can be "html" or "text".

  • isExpandable (Boolean):

    This node has children, so show the expando node (+ sign)

  • isExpanded (Boolean):

    This node is currently expanded (ie, opened)

  • state (String):

    Dynamic loading-related stuff. When an empty folder node appears, it is "NotLoaded" first, then after dojo.data query it becomes "Loading" and, finally "Loaded"

  • templateString
  • baseClass
  • cssStateNodes
  • _setTooltipAttr
  • buildRendering
  • _setIndentAttr:

    Tell this node how many levels it should be indented

  • markProcessing:

    Visually denote that tree is loading data, etc.

  • unmarkProcessing:

    Clear markup from markProcessing() call

  • _updateItemClasses:

    Set appropriate CSS classes for icon and label dom node (used to allow for item updates to change respective CSS)

  • _applyClassAndStyle:

    Set the appropriate CSS classes and styles for labels, icons and rows.

  • _updateLayout:

    Set appropriate CSS classes for this.domNode

  • _setExpando:

    Set the right image for the expando node

  • expand:

    Show my children

  • collapse:

    Collapse this node (if it's expanded)

  • indent (Integer):

    Levels from this node to the root node

  • setChildItems:

    Sets the child items of this node, removing/adding nodes from current children to match specified items[] array. Also, if this.persist == true, expands any children that were previously opened.

  • getTreePath
  • getIdentity
  • removeChild
  • makeExpandable:

    if this node wasn't already showing the expando node, turn it into one and call _setExpando()

  • setSelected:

    A Tree has a (single) currently selected node. Mark that this node is/isn't that currently selected node.

  • focus
  • onClick:

    Connect to this function to receive notifications of mouse click events.

  • onDblClick:

    Connect to this function to receive notifications of mouse double click events.

  • onKeyDown:

    Connect to this function to receive notifications of keys being pressed down.

  • onKeyPress:

    Connect to this function to receive notifications of printable keys being typed.

  • onKeyUp:

    Connect to this function to receive notifications of keys being released.

  • onMouseDown:

    Connect to this function to receive notifications of when the mouse button is pressed down.

  • onMouseMove:

    Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget.

  • onMouseOut:

    Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget.

  • onMouseOver:

    Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget.

  • onMouseLeave:

    Connect to this function to receive notifications of when the mouse moves off of this widget.

  • onMouseEnter:

    Connect to this function to receive notifications of when the mouse moves onto this widget.

  • onMouseUp:

    Connect to this function to receive notifications of when the mouse button is released.

  • postCreate
  • on
  • _setFocusedAttr
  • setAttribute:

    Deprecated. Use set() instead.

  • attr:

    This method is deprecated, use get() or set() directly.

  • getDescendants:

    Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode. This method should generally be avoided as it returns widgets declared in templates, which are supposed to be internal/hidden, but it's left here for back-compat reasons.

  • _onShow:

    Internal method called when this widget is made visible. See onShow for details.

  • onShow:

    Called when this widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.

    Also called to indicate display of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane.

  • onHide:

    Called when another widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.

    Also called to indicate hide of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane.

  • onClose:

    Called when this widget is being displayed as a popup (ex: a Calendar popped up from a DateTextBox), and it is hidden. This is called from the dijit.popup code, and should not be called directly.

    Also used as a parameter for children of dijit/layout/StackContainer or subclasses. Callback if a user tries to close the child. Child will be closed if this function returns true.

  • id (String):

    A unique, opaque ID string that can be assigned by users or by the system. If the developer passes an ID which is known not to be unique, the specified ID is ignored and the system-generated ID is used instead.

  • _setIdAttr
  • lang (String):

    Rarely used. Overrides the default Dojo locale used to render this widget, as defined by the HTML LANG attribute. Value must be among the list of locales specified during by the Dojo bootstrap, formatted according to RFC 3066 (like en-us).

  • _setLangAttr
  • dir (String):

    Bi-directional support, as defined by the HTML DIR attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's default direction.

  • _setDirAttr
  • class
  • _setClassAttr
  • _setTypeAttr
  • style (String||Object):

    HTML style attributes as cssText string or name/value hash

  • title (String):

    HTML title attribute.

    For form widgets this specifies a tooltip to display when hovering over the widget (just like the native HTML title attribute).

    For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer, etc., it's used to specify the tab label, accordion pane title, etc. In this case it's interpreted as HTML.

  • tooltip (String):

    When this widget's title attribute is used to for a tab label, accordion pane title, etc., this specifies the tooltip to appear when the mouse is hovered over that text.

  • srcNodeRef (DomNode):

    pointer to original DOM node

  • domNode (DomNode):

    This is our visible representation of the widget! Other DOM Nodes may by assigned to other properties, usually through the template system's data-dojo-attach-point syntax, but the domNode property is the canonical "top level" node in widget UI.

  • containerNode (DomNode):

    Designates where children of the source DOM node will be placed. "Children" in this case refers to both DOM nodes and widgets. For example, for myWidget:

    1
    2
    3
    4
    5
    <div data-dojo-type=myWidget>
        <b> here's a plain DOM node
        <span data-dojo-type=subWidget>and a widget</span>
        <i> and another plain DOM node </i>
    </div>

    containerNode would point to:

    1
    2
    3
    <b> here's a plain DOM node
    <span data-dojo-type=subWidget>and a widget</span>
    <i> and another plain DOM node </i>

    In templated widgets, "containerNode" is set via a data-dojo-attach-point assignment.

    containerNode must be defined for any widget that accepts innerHTML (like ContentPane or BorderContainer or even Button), and conversely is null for widgets that don't, like TextBox.

  • ownerDocument (Document?, optional):

    The document this widget belongs to. If not specified to constructor, will default to srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global

  • _setOwnerDocumentAttr
  • _started (Boolean):

    startup() has completed.

  • attributeMap (Object):

    Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute for each XXX attribute to be mapped to the DOM.

    attributeMap sets up a "binding" between attributes (aka properties) of the widget and the widget's DOM. Changes to widget attributes listed in attributeMap will be reflected into the DOM.

    For example, calling set('title', 'hello') on a TitlePane will automatically cause the TitlePane's DOM to update with the new title.

    attributeMap is a hash where the key is an attribute of the widget, and the value reflects a binding to a:

    • DOM node attribute

      focus: {node: "focusNode", type: "attribute"} Maps this.focus to this.focusNode.focus

    • DOM node innerHTML

      title: { node: "titleNode", type: "innerHTML" } Maps this.title to this.titleNode.innerHTML

    • DOM node innerText

      title: { node: "titleNode", type: "innerText" } Maps this.title to this.titleNode.innerText

    • DOM node CSS class

      myClass: { node: "domNode", type: "class" } Maps this.myClass to this.domNode.className

    If the value is an array, then each element in the array matches one of the formats of the above list.

    There are also some shorthands for backwards compatibility:

    • string --> { node: string, type: "attribute" }, for example:
    1
    "focusNode" ---> { node: "focusNode", type: "attribute" }
    • "" --> { node: "domNode", type: "attribute" }
  • _blankGif (String):

    Path to a blank 1x1 image. Used by <img> nodes in templates that really get their image via CSS background-image.

  • _introspect:

    Collect metadata about this widget (only once per class, not once per instance):

    1
    2
    - list of attributes with custom setters, storing in this.constructor._setterAttrs
    - generate this.constructor._onMap, mapping names like "mousedown" to functions like onMouseDown
  • postscript:

    Kicks off widget instantiation. See create() for details.

  • create:

    Kick off the life-cycle of a widget

  • _applyAttributes:

    Step during widget creation to copy widget attributes to the DOM according to attributeMap and _setXXXAttr objects, and also to call custom _setXXXAttr() methods.

    Skips over blank/false attribute values, unless they were explicitly specified as parameters to the widget, since those are the default anyway, and setting tabIndex="" is different than not setting tabIndex at all.

    For backwards-compatibility reasons attributeMap overrides _setXXXAttr when _setXXXAttr is a hash/string/array, but _setXXXAttr as a functions override attributeMap.

  • postMixInProperties:

    Called after the parameters to the widget have been read-in, but before the widget template is instantiated. Especially useful to set properties that are referenced in the widget template.

  • startup:

    Processing after the DOM fragment is added to the document

  • destroyRecursive:

    Destroy this widget and its descendants

  • destroy:

    Destroy this widget, but not its descendants. Descendants means widgets inside of this.containerNode. Will also destroy any resources (including widgets) registered via this.own().

    This method will also destroy internal widgets such as those created from a template, assuming those widgets exist inside of this.domNode but outside of this.containerNode.

    For 2.0 it's planned that this method will also destroy descendant widgets, so apps should not depend on the current ability to destroy a widget without destroying its descendants. Generally they should use destroyRecursive() for widgets with children.

  • destroyRendering:

    Destroys the DOM nodes associated with this widget.

  • destroyDescendants:

    Recursively destroy the children of this widget and their descendants.

  • uninitialize:

    Deprecated. Override destroy() instead to implement custom widget tear-down behavior.

  • _setStyleAttr:

    Sets the style attribute of the widget according to value, which is either a hash like {height: "5px", width: "3px"} or a plain string

  • _attrToDom:

    Reflect a widget attribute (title, tabIndex, duration etc.) to the widget DOM, as specified by commands parameter. If commands isn't specified then it's looked up from attributeMap. Note some attributes like "type" cannot be processed this way as they are not mutable.

  • get:

    Get a property from a widget.

  • set:

    Set a property on a widget

  • _attrPairNames
  • _getAttrNames:

    Helper function for get() and set(). Caches attribute name values so we don't do the string ops every time.

  • _set:

    Helper function to set new value for specified property, and call handlers registered with watch() if the value has changed.

  • _get:

    Helper function to get value for specified property stored by this._set(), i.e. for properties with custom setters. Used mainly by custom getters.

    For example, CheckBox._getValueAttr() calls this._get("value").

  • emit:

    Used by widgets to signal that a synthetic event occurred, ex:

    1
    myWidget.emit("attrmodified-selectedChildWidget", {}).

    Emits an event on this.domNode named type.toLowerCase(), based on eventObj. Also calls onType() method, if present, and returns value from that method. By default passes eventObj to callback, but will pass callbackArgs instead, if specified. Modifies eventObj by adding missing parameters (bubbles, cancelable, widget).

  • _onMap:

    Maps on() type parameter (ex: "mousemove") to method name (ex: "onMouseMove"). If type is a synthetic event like touch.press then returns undefined.

  • toString:

    Returns a string that represents the widget.

  • getChildren:

    Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent is this widget. Note that it does not return all descendants, but rather just direct children. Analogous to Node.childNodes, except containing widgets rather than DOMNodes.

    The result intentionally excludes internally created widgets (a.k.a. supporting widgets) outside of this.containerNode.

    Note that the array returned is a simple array. Application code should not assume existence of methods like forEach().

  • getParent:

    Returns the parent widget of this widget.

  • connect:

    Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead.

    Connects specified obj/event to specified method of this object and registers for disconnect() on widget destroy.

    Provide widget-specific analog to dojo.connect, except with the implicit use of this widget as the target object. Events connected with this.connect are disconnected upon destruction.

  • disconnect:

    Deprecated, will be removed in 2.0, use handle.remove() instead.

    Disconnects handle created by connect.

  • subscribe:

    Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead.

    Subscribes to the specified topic and calls the specified method of this object and registers for unsubscribe() on widget destroy.

    Provide widget-specific analog to dojo.subscribe, except with the implicit use of this widget as the target object.

  • unsubscribe:

    Deprecated, will be removed in 2.0, use handle.remove() instead.

    Unsubscribes handle created by this.subscribe. Also removes handle from this widget's list of subscriptions

  • isLeftToRight:

    Return this widget's explicit or implicit orientation (true for LTR, false for RTL)

  • isFocusable:

    Return true if this widget can currently be focused and false if not

  • placeAt:

    Place this widget somewhere in the DOM based on standard domConstruct.place() conventions.

  • defer:

    Wrapper to setTimeout to avoid deferred functions executing after the originating widget has been destroyed. Returns an object handle with a remove method (that returns null) (replaces clearTimeout).

  • _changeAttrValue:

    Internal helper for directly changing an attribute value.

  • watch:

    Watches a property for changes

  • own:

    Track specified handles and remove/destroy them when this instance is destroyed, unless they were already removed/destroyed manually.

  • focused (Boolean):

    This widget or a widget it contains has focus, or is "active" because it was recently clicked.

  • onFocus:

    Called when the widget becomes "active" because it or a widget inside of it either has focus, or has recently been clicked.

  • onBlur:

    Called when the widget stops being "active" because focus moved to something outside of it, or the user clicked somewhere outside of it, or the widget was hidden.

  • _onFocus:

    This is where widgets do processing for when they are active, such as changing CSS classes. See onFocus() for more details.

  • _onBlur:

    This is where widgets do processing for when they stop being active, such as changing CSS classes. See onBlur() for more details.

  • _focusManager
  • templatePath (String):

    Path to template (HTML file) for this widget relative to dojo.baseUrl. Deprecated: use templateString with require([... "dojo/text!..."], ...) instead

  • _skipNodeCache
  • _rendered (Boolean):

    Not normally use, but this flag can be set by the app if the server has already rendered the template, i.e. already inlining the template for the widget into the main page. Reduces _TemplatedMixin to just function like _AttachMixin.

  • searchContainerNode
  • _stringRepl:

    Does substitution of ${foo} type properties in template string

  • _escapeValue:

    Escape a value to be inserted into the template, either into an attribute value (ex: foo="${bar}") or as inner text of an element (ex: ${foo})

  • _fillContent:

    Relocate source contents to templated container node. this.containerNode must be able to receive children, or exceptions will be thrown.

  • _attachPoints (String[]):

    List of widget attribute names associated with data-dojo-attach-point=... in the template, ex: ["containerNode", "labelNode"]

  • _attachEvents (Handle[]):

    List of connections associated with data-dojo-attach-event=... in the template

  • attachScope (Object):

    Object to which attach points and events will be scoped. Defaults to 'this'.

  • _beforeFillContent
  • _attachTemplateNodes:

    Iterate through the dom nodes and attach functions and nodes accordingly.

  • _processTemplateNode:

    Process data-dojo-attach-point and data-dojo-attach-event for given node or widget. Returns true if caller should process baseNode's children too.

  • _attach:

    Roughly corresponding to dojo/on, this is the default function for processing a data-dojo-attach-event. Meant to attach to DOMNodes, not to widgets.

  • _detachTemplateNodes:

    Detach and clean up the attachments made in _attachtempalteNodes.

  • addChild:

    Makes the given widget a child of this widget.

  • hasChildren:

    Returns true if widget has child widgets, i.e. if this.containerNode contains widgets.

  • _getSiblingOfChild:

    Get the next or previous widget sibling of child

  • getIndexOfChild:

    Gets the index of the child in this container or -1 if not found

  • _getSibling:

    Returns next or previous sibling

  • getPreviousSibling:

    Returns null if this is the first child of the parent, otherwise returns the next element sibling to the "left".

  • getNextSibling:

    Returns null if this is the last child of the parent, otherwise returns the next element sibling to the "right".

  • getIndexInParent:

    Returns the index of this widget within its container parent. It returns -1 if the parent does not exist, or if the parent is not a dijit/_Container

  • hovering (Boolean):

    True if cursor is over this widget

  • active (Boolean):

    True if mouse was pressed while over this widget, and hasn't been released yet

  • _cssMouseEvent:

    Handler for CSS event on this.domNode. Sets hovering and active properties depending on mouse state, which triggers _setStateClass() to set appropriate CSS classes for this.domNode.

  • _setStateClass:

    Update the visual state of the widget by setting the css classes on this.domNode (or this.stateNode if defined) by combining this.baseClass with various suffixes that represent the current widget state(s).

  • _subnodeCssMouseEvent:

    Handler for hover/active mouse event on widget's subnode

  • _trackMouseState:

    Track mouse/focus events on specified node and set CSS class on that node to indicate current state. Usually not called directly, but via cssStateNodes attribute.

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
_onMap(type)
Defined by: dijit/_WidgetBase

Maps on() type parameter (ex: "mousemove") to method name (ex: "onMouseMove"). If type is a synthetic event like touch.press then returns undefined.

Parameter Type Description
type String | Function
Returns:undefined

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
_onNodeMouseEnter(node)
Defined by: dijit/Tree

Called when mouse is over a node (onmouseenter event), this is monitored by the DND code

Parameter Type Description
node dijit/_WidgetBase

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
_onNodeMouseLeave(node)
Defined by: dijit/Tree

Called when mouse leaves a node (onmouseleave event), this is monitored by the DND code

Parameter Type Description
node dijit/_WidgetBase

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
_onNodePress(nodeWidget,e)
Defined by: dijit/Tree
Parameter Type Description
nodeWidget Object

An object with the following properties:

  • item (Item):

    the dojo.data entry this tree represents

  • isTreeNode (Boolean):

    Indicates that this is a TreeNode. Used by dijit.Tree only, should not be accessed directly.

  • label (String):

    Text of this tree node

  • _setLabelAttr
  • labelType (String):

    Specifies how to interpret the label. Can be "html" or "text".

  • isExpandable (Boolean):

    This node has children, so show the expando node (+ sign)

  • isExpanded (Boolean):

    This node is currently expanded (ie, opened)

  • state (String):

    Dynamic loading-related stuff. When an empty folder node appears, it is "NotLoaded" first, then after dojo.data query it becomes "Loading" and, finally "Loaded"

  • templateString
  • baseClass
  • cssStateNodes
  • _setTooltipAttr
  • buildRendering
  • _setIndentAttr:

    Tell this node how many levels it should be indented

  • markProcessing:

    Visually denote that tree is loading data, etc.

  • unmarkProcessing:

    Clear markup from markProcessing() call

  • _updateItemClasses:

    Set appropriate CSS classes for icon and label dom node (used to allow for item updates to change respective CSS)

  • _applyClassAndStyle:

    Set the appropriate CSS classes and styles for labels, icons and rows.

  • _updateLayout:

    Set appropriate CSS classes for this.domNode

  • _setExpando:

    Set the right image for the expando node

  • expand:

    Show my children

  • collapse:

    Collapse this node (if it's expanded)

  • indent (Integer):

    Levels from this node to the root node

  • setChildItems:

    Sets the child items of this node, removing/adding nodes from current children to match specified items[] array. Also, if this.persist == true, expands any children that were previously opened.

  • getTreePath
  • getIdentity
  • removeChild
  • makeExpandable:

    if this node wasn't already showing the expando node, turn it into one and call _setExpando()

  • setSelected:

    A Tree has a (single) currently selected node. Mark that this node is/isn't that currently selected node.

  • focus
  • onClick:

    Connect to this function to receive notifications of mouse click events.

  • onDblClick:

    Connect to this function to receive notifications of mouse double click events.

  • onKeyDown:

    Connect to this function to receive notifications of keys being pressed down.

  • onKeyPress:

    Connect to this function to receive notifications of printable keys being typed.

  • onKeyUp:

    Connect to this function to receive notifications of keys being released.

  • onMouseDown:

    Connect to this function to receive notifications of when the mouse button is pressed down.

  • onMouseMove:

    Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget.

  • onMouseOut:

    Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget.

  • onMouseOver:

    Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget.

  • onMouseLeave:

    Connect to this function to receive notifications of when the mouse moves off of this widget.

  • onMouseEnter:

    Connect to this function to receive notifications of when the mouse moves onto this widget.

  • onMouseUp:

    Connect to this function to receive notifications of when the mouse button is released.

  • postCreate
  • on
  • _setFocusedAttr
  • setAttribute:

    Deprecated. Use set() instead.

  • attr:

    This method is deprecated, use get() or set() directly.

  • getDescendants:

    Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode. This method should generally be avoided as it returns widgets declared in templates, which are supposed to be internal/hidden, but it's left here for back-compat reasons.

  • _onShow:

    Internal method called when this widget is made visible. See onShow for details.

  • onShow:

    Called when this widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.

    Also called to indicate display of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane.

  • onHide:

    Called when another widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.

    Also called to indicate hide of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane.

  • onClose:

    Called when this widget is being displayed as a popup (ex: a Calendar popped up from a DateTextBox), and it is hidden. This is called from the dijit.popup code, and should not be called directly.

    Also used as a parameter for children of dijit/layout/StackContainer or subclasses. Callback if a user tries to close the child. Child will be closed if this function returns true.

  • id (String):

    A unique, opaque ID string that can be assigned by users or by the system. If the developer passes an ID which is known not to be unique, the specified ID is ignored and the system-generated ID is used instead.

  • _setIdAttr
  • lang (String):

    Rarely used. Overrides the default Dojo locale used to render this widget, as defined by the HTML LANG attribute. Value must be among the list of locales specified during by the Dojo bootstrap, formatted according to RFC 3066 (like en-us).

  • _setLangAttr
  • dir (String):

    Bi-directional support, as defined by the HTML DIR attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's default direction.

  • _setDirAttr
  • class
  • _setClassAttr
  • _setTypeAttr
  • style (String||Object):

    HTML style attributes as cssText string or name/value hash

  • title (String):

    HTML title attribute.

    For form widgets this specifies a tooltip to display when hovering over the widget (just like the native HTML title attribute).

    For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer, etc., it's used to specify the tab label, accordion pane title, etc. In this case it's interpreted as HTML.

  • tooltip (String):

    When this widget's title attribute is used to for a tab label, accordion pane title, etc., this specifies the tooltip to appear when the mouse is hovered over that text.

  • srcNodeRef (DomNode):

    pointer to original DOM node

  • domNode (DomNode):

    This is our visible representation of the widget! Other DOM Nodes may by assigned to other properties, usually through the template system's data-dojo-attach-point syntax, but the domNode property is the canonical "top level" node in widget UI.

  • containerNode (DomNode):

    Designates where children of the source DOM node will be placed. "Children" in this case refers to both DOM nodes and widgets. For example, for myWidget:

    1
    2
    3
    4
    5
    <div data-dojo-type=myWidget>
        <b> here's a plain DOM node
        <span data-dojo-type=subWidget>and a widget</span>
        <i> and another plain DOM node </i>
    </div>

    containerNode would point to:

    1
    2
    3
    <b> here's a plain DOM node
    <span data-dojo-type=subWidget>and a widget</span>
    <i> and another plain DOM node </i>

    In templated widgets, "containerNode" is set via a data-dojo-attach-point assignment.

    containerNode must be defined for any widget that accepts innerHTML (like ContentPane or BorderContainer or even Button), and conversely is null for widgets that don't, like TextBox.

  • ownerDocument (Document?, optional):

    The document this widget belongs to. If not specified to constructor, will default to srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global

  • _setOwnerDocumentAttr
  • _started (Boolean):

    startup() has completed.

  • attributeMap (Object):

    Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute for each XXX attribute to be mapped to the DOM.

    attributeMap sets up a "binding" between attributes (aka properties) of the widget and the widget's DOM. Changes to widget attributes listed in attributeMap will be reflected into the DOM.

    For example, calling set('title', 'hello') on a TitlePane will automatically cause the TitlePane's DOM to update with the new title.

    attributeMap is a hash where the key is an attribute of the widget, and the value reflects a binding to a:

    • DOM node attribute

      focus: {node: "focusNode", type: "attribute"} Maps this.focus to this.focusNode.focus

    • DOM node innerHTML

      title: { node: "titleNode", type: "innerHTML" } Maps this.title to this.titleNode.innerHTML

    • DOM node innerText

      title: { node: "titleNode", type: "innerText" } Maps this.title to this.titleNode.innerText

    • DOM node CSS class

      myClass: { node: "domNode", type: "class" } Maps this.myClass to this.domNode.className

    If the value is an array, then each element in the array matches one of the formats of the above list.

    There are also some shorthands for backwards compatibility:

    • string --> { node: string, type: "attribute" }, for example:
    1
    "focusNode" ---> { node: "focusNode", type: "attribute" }
    • "" --> { node: "domNode", type: "attribute" }
  • _blankGif (String):

    Path to a blank 1x1 image. Used by <img> nodes in templates that really get their image via CSS background-image.

  • _introspect:

    Collect metadata about this widget (only once per class, not once per instance):

    1
    2
    - list of attributes with custom setters, storing in this.constructor._setterAttrs
    - generate this.constructor._onMap, mapping names like "mousedown" to functions like onMouseDown
  • postscript:

    Kicks off widget instantiation. See create() for details.

  • create:

    Kick off the life-cycle of a widget

  • _applyAttributes:

    Step during widget creation to copy widget attributes to the DOM according to attributeMap and _setXXXAttr objects, and also to call custom _setXXXAttr() methods.

    Skips over blank/false attribute values, unless they were explicitly specified as parameters to the widget, since those are the default anyway, and setting tabIndex="" is different than not setting tabIndex at all.

    For backwards-compatibility reasons attributeMap overrides _setXXXAttr when _setXXXAttr is a hash/string/array, but _setXXXAttr as a functions override attributeMap.

  • postMixInProperties:

    Called after the parameters to the widget have been read-in, but before the widget template is instantiated. Especially useful to set properties that are referenced in the widget template.

  • startup:

    Processing after the DOM fragment is added to the document

  • destroyRecursive:

    Destroy this widget and its descendants

  • destroy:

    Destroy this widget, but not its descendants. Descendants means widgets inside of this.containerNode. Will also destroy any resources (including widgets) registered via this.own().

    This method will also destroy internal widgets such as those created from a template, assuming those widgets exist inside of this.domNode but outside of this.containerNode.

    For 2.0 it's planned that this method will also destroy descendant widgets, so apps should not depend on the current ability to destroy a widget without destroying its descendants. Generally they should use destroyRecursive() for widgets with children.

  • destroyRendering:

    Destroys the DOM nodes associated with this widget.

  • destroyDescendants:

    Recursively destroy the children of this widget and their descendants.

  • uninitialize:

    Deprecated. Override destroy() instead to implement custom widget tear-down behavior.

  • _setStyleAttr:

    Sets the style attribute of the widget according to value, which is either a hash like {height: "5px", width: "3px"} or a plain string

  • _attrToDom:

    Reflect a widget attribute (title, tabIndex, duration etc.) to the widget DOM, as specified by commands parameter. If commands isn't specified then it's looked up from attributeMap. Note some attributes like "type" cannot be processed this way as they are not mutable.

  • get:

    Get a property from a widget.

  • set:

    Set a property on a widget

  • _attrPairNames
  • _getAttrNames:

    Helper function for get() and set(). Caches attribute name values so we don't do the string ops every time.

  • _set:

    Helper function to set new value for specified property, and call handlers registered with watch() if the value has changed.

  • _get:

    Helper function to get value for specified property stored by this._set(), i.e. for properties with custom setters. Used mainly by custom getters.

    For example, CheckBox._getValueAttr() calls this._get("value").

  • emit:

    Used by widgets to signal that a synthetic event occurred, ex:

    1
    myWidget.emit("attrmodified-selectedChildWidget", {}).

    Emits an event on this.domNode named type.toLowerCase(), based on eventObj. Also calls onType() method, if present, and returns value from that method. By default passes eventObj to callback, but will pass callbackArgs instead, if specified. Modifies eventObj by adding missing parameters (bubbles, cancelable, widget).

  • _onMap:

    Maps on() type parameter (ex: "mousemove") to method name (ex: "onMouseMove"). If type is a synthetic event like touch.press then returns undefined.

  • toString:

    Returns a string that represents the widget.

  • getChildren:

    Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent is this widget. Note that it does not return all descendants, but rather just direct children. Analogous to Node.childNodes, except containing widgets rather than DOMNodes.

    The result intentionally excludes internally created widgets (a.k.a. supporting widgets) outside of this.containerNode.

    Note that the array returned is a simple array. Application code should not assume existence of methods like forEach().

  • getParent:

    Returns the parent widget of this widget.

  • connect:

    Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead.

    Connects specified obj/event to specified method of this object and registers for disconnect() on widget destroy.

    Provide widget-specific analog to dojo.connect, except with the implicit use of this widget as the target object. Events connected with this.connect are disconnected upon destruction.

  • disconnect:

    Deprecated, will be removed in 2.0, use handle.remove() instead.

    Disconnects handle created by connect.

  • subscribe:

    Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead.

    Subscribes to the specified topic and calls the specified method of this object and registers for unsubscribe() on widget destroy.

    Provide widget-specific analog to dojo.subscribe, except with the implicit use of this widget as the target object.

  • unsubscribe:

    Deprecated, will be removed in 2.0, use handle.remove() instead.

    Unsubscribes handle created by this.subscribe. Also removes handle from this widget's list of subscriptions

  • isLeftToRight:

    Return this widget's explicit or implicit orientation (true for LTR, false for RTL)

  • isFocusable:

    Return true if this widget can currently be focused and false if not

  • placeAt:

    Place this widget somewhere in the DOM based on standard domConstruct.place() conventions.

  • defer:

    Wrapper to setTimeout to avoid deferred functions executing after the originating widget has been destroyed. Returns an object handle with a remove method (that returns null) (replaces clearTimeout).

  • _changeAttrValue:

    Internal helper for directly changing an attribute value.

  • watch:

    Watches a property for changes

  • own:

    Track specified handles and remove/destroy them when this instance is destroyed, unless they were already removed/destroyed manually.

  • focused (Boolean):

    This widget or a widget it contains has focus, or is "active" because it was recently clicked.

  • onFocus:

    Called when the widget becomes "active" because it or a widget inside of it either has focus, or has recently been clicked.

  • onBlur:

    Called when the widget stops being "active" because focus moved to something outside of it, or the user clicked somewhere outside of it, or the widget was hidden.

  • _onFocus:

    This is where widgets do processing for when they are active, such as changing CSS classes. See onFocus() for more details.

  • _onBlur:

    This is where widgets do processing for when they stop being active, such as changing CSS classes. See onBlur() for more details.

  • _focusManager
  • templatePath (String):

    Path to template (HTML file) for this widget relative to dojo.baseUrl. Deprecated: use templateString with require([... "dojo/text!..."], ...) instead

  • _skipNodeCache
  • _rendered (Boolean):

    Not normally use, but this flag can be set by the app if the server has already rendered the template, i.e. already inlining the template for the widget into the main page. Reduces _TemplatedMixin to just function like _AttachMixin.

  • searchContainerNode
  • _stringRepl:

    Does substitution of ${foo} type properties in template string

  • _escapeValue:

    Escape a value to be inserted into the template, either into an attribute value (ex: foo="${bar}") or as inner text of an element (ex: ${foo})

  • _fillContent:

    Relocate source contents to templated container node. this.containerNode must be able to receive children, or exceptions will be thrown.

  • _attachPoints (String[]):

    List of widget attribute names associated with data-dojo-attach-point=... in the template, ex: ["containerNode", "labelNode"]

  • _attachEvents (Handle[]):

    List of connections associated with data-dojo-attach-event=... in the template

  • attachScope (Object):

    Object to which attach points and events will be scoped. Defaults to 'this'.

  • _beforeFillContent
  • _attachTemplateNodes:

    Iterate through the dom nodes and attach functions and nodes accordingly.

  • _processTemplateNode:

    Process data-dojo-attach-point and data-dojo-attach-event for given node or widget. Returns true if caller should process baseNode's children too.

  • _attach:

    Roughly corresponding to dojo/on, this is the default function for processing a data-dojo-attach-event. Meant to attach to DOMNodes, not to widgets.

  • _detachTemplateNodes:

    Detach and clean up the attachments made in _attachtempalteNodes.

  • addChild:

    Makes the given widget a child of this widget.

  • hasChildren:

    Returns true if widget has child widgets, i.e. if this.containerNode contains widgets.

  • _getSiblingOfChild:

    Get the next or previous widget sibling of child

  • getIndexOfChild:

    Gets the index of the child in this container or -1 if not found

  • _getSibling:

    Returns next or previous sibling

  • getPreviousSibling:

    Returns null if this is the first child of the parent, otherwise returns the next element sibling to the "left".

  • getNextSibling:

    Returns null if this is the last child of the parent, otherwise returns the next element sibling to the "right".

  • getIndexInParent:

    Returns the index of this widget within its container parent. It returns -1 if the parent does not exist, or if the parent is not a dijit/_Container

  • hovering (Boolean):

    True if cursor is over this widget

  • active (Boolean):

    True if mouse was pressed while over this widget, and hasn't been released yet

  • _cssMouseEvent:

    Handler for CSS event on this.domNode. Sets hovering and active properties depending on mouse state, which triggers _setStateClass() to set appropriate CSS classes for this.domNode.

  • _setStateClass:

    Update the visual state of the widget by setting the css classes on this.domNode (or this.stateNode if defined) by combining this.baseClass with various suffixes that represent the current widget state(s).

  • _subnodeCssMouseEvent:

    Handler for hover/active mouse event on widget's subnode

  • _trackMouseState:

    Track mouse/focus events on specified node and set CSS class on that node to indicate current state. Usually not called directly, but via cssStateNodes attribute.

e Event

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
_onRightArrow(evt,node)
Defined by: dijit/Tree

Right arrow pressed; go to child node

Parameter Type Description
evt Event
node Object

An object with the following properties:

  • item (Item):

    the dojo.data entry this tree represents

  • isTreeNode (Boolean):

    Indicates that this is a TreeNode. Used by dijit.Tree only, should not be accessed directly.

  • label (String):

    Text of this tree node

  • _setLabelAttr
  • labelType (String):

    Specifies how to interpret the label. Can be "html" or "text".

  • isExpandable (Boolean):

    This node has children, so show the expando node (+ sign)

  • isExpanded (Boolean):

    This node is currently expanded (ie, opened)

  • state (String):

    Dynamic loading-related stuff. When an empty folder node appears, it is "NotLoaded" first, then after dojo.data query it becomes "Loading" and, finally "Loaded"

  • templateString
  • baseClass
  • cssStateNodes
  • _setTooltipAttr
  • buildRendering
  • _setIndentAttr:

    Tell this node how many levels it should be indented

  • markProcessing:

    Visually denote that tree is loading data, etc.

  • unmarkProcessing:

    Clear markup from markProcessing() call

  • _updateItemClasses:

    Set appropriate CSS classes for icon and label dom node (used to allow for item updates to change respective CSS)

  • _applyClassAndStyle:

    Set the appropriate CSS classes and styles for labels, icons and rows.

  • _updateLayout:

    Set appropriate CSS classes for this.domNode

  • _setExpando:

    Set the right image for the expando node

  • expand:

    Show my children

  • collapse:

    Collapse this node (if it's expanded)

  • indent (Integer):

    Levels from this node to the root node

  • setChildItems:

    Sets the child items of this node, removing/adding nodes from current children to match specified items[] array. Also, if this.persist == true, expands any children that were previously opened.

  • getTreePath
  • getIdentity
  • removeChild
  • makeExpandable:

    if this node wasn't already showing the expando node, turn it into one and call _setExpando()

  • setSelected:

    A Tree has a (single) currently selected node. Mark that this node is/isn't that currently selected node.

  • focus
  • onClick:

    Connect to this function to receive notifications of mouse click events.

  • onDblClick:

    Connect to this function to receive notifications of mouse double click events.

  • onKeyDown:

    Connect to this function to receive notifications of keys being pressed down.

  • onKeyPress:

    Connect to this function to receive notifications of printable keys being typed.

  • onKeyUp:

    Connect to this function to receive notifications of keys being released.

  • onMouseDown:

    Connect to this function to receive notifications of when the mouse button is pressed down.

  • onMouseMove:

    Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget.

  • onMouseOut:

    Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget.

  • onMouseOver:

    Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget.

  • onMouseLeave:

    Connect to this function to receive notifications of when the mouse moves off of this widget.

  • onMouseEnter:

    Connect to this function to receive notifications of when the mouse moves onto this widget.

  • onMouseUp:

    Connect to this function to receive notifications of when the mouse button is released.

  • postCreate
  • on
  • _setFocusedAttr
  • setAttribute:

    Deprecated. Use set() instead.

  • attr:

    This method is deprecated, use get() or set() directly.

  • getDescendants:

    Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode. This method should generally be avoided as it returns widgets declared in templates, which are supposed to be internal/hidden, but it's left here for back-compat reasons.

  • _onShow:

    Internal method called when this widget is made visible. See onShow for details.

  • onShow:

    Called when this widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.

    Also called to indicate display of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane.

  • onHide:

    Called when another widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.

    Also called to indicate hide of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane.

  • onClose:

    Called when this widget is being displayed as a popup (ex: a Calendar popped up from a DateTextBox), and it is hidden. This is called from the dijit.popup code, and should not be called directly.

    Also used as a parameter for children of dijit/layout/StackContainer or subclasses. Callback if a user tries to close the child. Child will be closed if this function returns true.

  • id (String):

    A unique, opaque ID string that can be assigned by users or by the system. If the developer passes an ID which is known not to be unique, the specified ID is ignored and the system-generated ID is used instead.

  • _setIdAttr
  • lang (String):

    Rarely used. Overrides the default Dojo locale used to render this widget, as defined by the HTML LANG attribute. Value must be among the list of locales specified during by the Dojo bootstrap, formatted according to RFC 3066 (like en-us).

  • _setLangAttr
  • dir (String):

    Bi-directional support, as defined by the HTML DIR attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's default direction.

  • _setDirAttr
  • class
  • _setClassAttr
  • _setTypeAttr
  • style (String||Object):

    HTML style attributes as cssText string or name/value hash

  • title (String):

    HTML title attribute.

    For form widgets this specifies a tooltip to display when hovering over the widget (just like the native HTML title attribute).

    For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer, etc., it's used to specify the tab label, accordion pane title, etc. In this case it's interpreted as HTML.

  • tooltip (String):

    When this widget's title attribute is used to for a tab label, accordion pane title, etc., this specifies the tooltip to appear when the mouse is hovered over that text.

  • srcNodeRef (DomNode):

    pointer to original DOM node

  • domNode (DomNode):

    This is our visible representation of the widget! Other DOM Nodes may by assigned to other properties, usually through the template system's data-dojo-attach-point syntax, but the domNode property is the canonical "top level" node in widget UI.

  • containerNode (DomNode):

    Designates where children of the source DOM node will be placed. "Children" in this case refers to both DOM nodes and widgets. For example, for myWidget:

    1
    2
    3
    4
    5
    <div data-dojo-type=myWidget>
        <b> here's a plain DOM node
        <span data-dojo-type=subWidget>and a widget</span>
        <i> and another plain DOM node </i>
    </div>

    containerNode would point to:

    1
    2
    3
    <b> here's a plain DOM node
    <span data-dojo-type=subWidget>and a widget</span>
    <i> and another plain DOM node </i>

    In templated widgets, "containerNode" is set via a data-dojo-attach-point assignment.

    containerNode must be defined for any widget that accepts innerHTML (like ContentPane or BorderContainer or even Button), and conversely is null for widgets that don't, like TextBox.

  • ownerDocument (Document?, optional):

    The document this widget belongs to. If not specified to constructor, will default to srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global

  • _setOwnerDocumentAttr
  • _started (Boolean):

    startup() has completed.

  • attributeMap (Object):

    Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute for each XXX attribute to be mapped to the DOM.

    attributeMap sets up a "binding" between attributes (aka properties) of the widget and the widget's DOM. Changes to widget attributes listed in attributeMap will be reflected into the DOM.

    For example, calling set('title', 'hello') on a TitlePane will automatically cause the TitlePane's DOM to update with the new title.

    attributeMap is a hash where the key is an attribute of the widget, and the value reflects a binding to a:

    • DOM node attribute

      focus: {node: "focusNode", type: "attribute"} Maps this.focus to this.focusNode.focus

    • DOM node innerHTML

      title: { node: "titleNode", type: "innerHTML" } Maps this.title to this.titleNode.innerHTML

    • DOM node innerText

      title: { node: "titleNode", type: "innerText" } Maps this.title to this.titleNode.innerText

    • DOM node CSS class

      myClass: { node: "domNode", type: "class" } Maps this.myClass to this.domNode.className

    If the value is an array, then each element in the array matches one of the formats of the above list.

    There are also some shorthands for backwards compatibility:

    • string --> { node: string, type: "attribute" }, for example:
    1
    "focusNode" ---> { node: "focusNode", type: "attribute" }
    • "" --> { node: "domNode", type: "attribute" }
  • _blankGif (String):

    Path to a blank 1x1 image. Used by <img> nodes in templates that really get their image via CSS background-image.

  • _introspect:

    Collect metadata about this widget (only once per class, not once per instance):

    1
    2
    - list of attributes with custom setters, storing in this.constructor._setterAttrs
    - generate this.constructor._onMap, mapping names like "mousedown" to functions like onMouseDown
  • postscript:

    Kicks off widget instantiation. See create() for details.

  • create:

    Kick off the life-cycle of a widget

  • _applyAttributes:

    Step during widget creation to copy widget attributes to the DOM according to attributeMap and _setXXXAttr objects, and also to call custom _setXXXAttr() methods.

    Skips over blank/false attribute values, unless they were explicitly specified as parameters to the widget, since those are the default anyway, and setting tabIndex="" is different than not setting tabIndex at all.

    For backwards-compatibility reasons attributeMap overrides _setXXXAttr when _setXXXAttr is a hash/string/array, but _setXXXAttr as a functions override attributeMap.

  • postMixInProperties:

    Called after the parameters to the widget have been read-in, but before the widget template is instantiated. Especially useful to set properties that are referenced in the widget template.

  • startup:

    Processing after the DOM fragment is added to the document

  • destroyRecursive:

    Destroy this widget and its descendants

  • destroy:

    Destroy this widget, but not its descendants. Descendants means widgets inside of this.containerNode. Will also destroy any resources (including widgets) registered via this.own().

    This method will also destroy internal widgets such as those created from a template, assuming those widgets exist inside of this.domNode but outside of this.containerNode.

    For 2.0 it's planned that this method will also destroy descendant widgets, so apps should not depend on the current ability to destroy a widget without destroying its descendants. Generally they should use destroyRecursive() for widgets with children.

  • destroyRendering:

    Destroys the DOM nodes associated with this widget.

  • destroyDescendants:

    Recursively destroy the children of this widget and their descendants.

  • uninitialize:

    Deprecated. Override destroy() instead to implement custom widget tear-down behavior.

  • _setStyleAttr:

    Sets the style attribute of the widget according to value, which is either a hash like {height: "5px", width: "3px"} or a plain string

  • _attrToDom:

    Reflect a widget attribute (title, tabIndex, duration etc.) to the widget DOM, as specified by commands parameter. If commands isn't specified then it's looked up from attributeMap. Note some attributes like "type" cannot be processed this way as they are not mutable.

  • get:

    Get a property from a widget.

  • set:

    Set a property on a widget

  • _attrPairNames
  • _getAttrNames:

    Helper function for get() and set(). Caches attribute name values so we don't do the string ops every time.

  • _set:

    Helper function to set new value for specified property, and call handlers registered with watch() if the value has changed.

  • _get:

    Helper function to get value for specified property stored by this._set(), i.e. for properties with custom setters. Used mainly by custom getters.

    For example, CheckBox._getValueAttr() calls this._get("value").

  • emit:

    Used by widgets to signal that a synthetic event occurred, ex:

    1
    myWidget.emit("attrmodified-selectedChildWidget", {}).

    Emits an event on this.domNode named type.toLowerCase(), based on eventObj. Also calls onType() method, if present, and returns value from that method. By default passes eventObj to callback, but will pass callbackArgs instead, if specified. Modifies eventObj by adding missing parameters (bubbles, cancelable, widget).

  • _onMap:

    Maps on() type parameter (ex: "mousemove") to method name (ex: "onMouseMove"). If type is a synthetic event like touch.press then returns undefined.

  • toString:

    Returns a string that represents the widget.

  • getChildren:

    Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent is this widget. Note that it does not return all descendants, but rather just direct children. Analogous to Node.childNodes, except containing widgets rather than DOMNodes.

    The result intentionally excludes internally created widgets (a.k.a. supporting widgets) outside of this.containerNode.

    Note that the array returned is a simple array. Application code should not assume existence of methods like forEach().

  • getParent:

    Returns the parent widget of this widget.

  • connect:

    Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead.

    Connects specified obj/event to specified method of this object and registers for disconnect() on widget destroy.

    Provide widget-specific analog to dojo.connect, except with the implicit use of this widget as the target object. Events connected with this.connect are disconnected upon destruction.

  • disconnect:

    Deprecated, will be removed in 2.0, use handle.remove() instead.

    Disconnects handle created by connect.

  • subscribe:

    Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead.

    Subscribes to the specified topic and calls the specified method of this object and registers for unsubscribe() on widget destroy.

    Provide widget-specific analog to dojo.subscribe, except with the implicit use of this widget as the target object.

  • unsubscribe:

    Deprecated, will be removed in 2.0, use handle.remove() instead.

    Unsubscribes handle created by this.subscribe. Also removes handle from this widget's list of subscriptions

  • isLeftToRight:

    Return this widget's explicit or implicit orientation (true for LTR, false for RTL)

  • isFocusable:

    Return true if this widget can currently be focused and false if not

  • placeAt:

    Place this widget somewhere in the DOM based on standard domConstruct.place() conventions.

  • defer:

    Wrapper to setTimeout to avoid deferred functions executing after the originating widget has been destroyed. Returns an object handle with a remove method (that returns null) (replaces clearTimeout).

  • _changeAttrValue:

    Internal helper for directly changing an attribute value.

  • watch:

    Watches a property for changes

  • own:

    Track specified handles and remove/destroy them when this instance is destroyed, unless they were already removed/destroyed manually.

  • focused (Boolean):

    This widget or a widget it contains has focus, or is "active" because it was recently clicked.

  • onFocus:

    Called when the widget becomes "active" because it or a widget inside of it either has focus, or has recently been clicked.

  • onBlur:

    Called when the widget stops being "active" because focus moved to something outside of it, or the user clicked somewhere outside of it, or the widget was hidden.

  • _onFocus:

    This is where widgets do processing for when they are active, such as changing CSS classes. See onFocus() for more details.

  • _onBlur:

    This is where widgets do processing for when they stop being active, such as changing CSS classes. See onBlur() for more details.

  • _focusManager
  • templatePath (String):

    Path to template (HTML file) for this widget relative to dojo.baseUrl. Deprecated: use templateString with require([... "dojo/text!..."], ...) instead

  • _skipNodeCache
  • _rendered (Boolean):

    Not normally use, but this flag can be set by the app if the server has already rendered the template, i.e. already inlining the template for the widget into the main page. Reduces _TemplatedMixin to just function like _AttachMixin.

  • searchContainerNode
  • _stringRepl:

    Does substitution of ${foo} type properties in template string

  • _escapeValue:

    Escape a value to be inserted into the template, either into an attribute value (ex: foo="${bar}") or as inner text of an element (ex: ${foo})

  • _fillContent:

    Relocate source contents to templated container node. this.containerNode must be able to receive children, or exceptions will be thrown.

  • _attachPoints (String[]):

    List of widget attribute names associated with data-dojo-attach-point=... in the template, ex: ["containerNode", "labelNode"]

  • _attachEvents (Handle[]):

    List of connections associated with data-dojo-attach-event=... in the template

  • attachScope (Object):

    Object to which attach points and events will be scoped. Defaults to 'this'.

  • _beforeFillContent
  • _attachTemplateNodes:

    Iterate through the dom nodes and attach functions and nodes accordingly.

  • _processTemplateNode:

    Process data-dojo-attach-point and data-dojo-attach-event for given node or widget. Returns true if caller should process baseNode's children too.

  • _attach:

    Roughly corresponding to dojo/on, this is the default function for processing a data-dojo-attach-event. Meant to attach to DOMNodes, not to widgets.

  • _detachTemplateNodes:

    Detach and clean up the attachments made in _attachtempalteNodes.

  • addChild:

    Makes the given widget a child of this widget.

  • hasChildren:

    Returns true if widget has child widgets, i.e. if this.containerNode contains widgets.

  • _getSiblingOfChild:

    Get the next or previous widget sibling of child

  • getIndexOfChild:

    Gets the index of the child in this container or -1 if not found

  • _getSibling:

    Returns next or previous sibling

  • getPreviousSibling:

    Returns null if this is the first child of the parent, otherwise returns the next element sibling to the "left".

  • getNextSibling:

    Returns null if this is the last child of the parent, otherwise returns the next element sibling to the "right".

  • getIndexInParent:

    Returns the index of this widget within its container parent. It returns -1 if the parent does not exist, or if the parent is not a dijit/_Container

  • hovering (Boolean):

    True if cursor is over this widget

  • active (Boolean):

    True if mouse was pressed while over this widget, and hasn't been released yet

  • _cssMouseEvent:

    Handler for CSS event on this.domNode. Sets hovering and active properties depending on mouse state, which triggers _setStateClass() to set appropriate CSS classes for this.domNode.

  • _setStateClass:

    Update the visual state of the widget by setting the css classes on this.domNode (or this.stateNode if defined) by combining this.baseClass with various suffixes that represent the current widget state(s).

  • _subnodeCssMouseEvent:

    Handler for hover/active mouse event on widget's subnode

  • _trackMouseState:

    Track mouse/focus events on specified node and set CSS class on that node to indicate current state. Usually not called directly, but via cssStateNodes attribute.

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
_onShow()
Defined by: dijit/_Widget

Internal method called when this widget is made visible. See onShow for details.

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
_onUpArrow(evt,node)
Defined by: dijit/Tree

Up arrow pressed; move to previous visible node

Parameter Type Description
evt Event
node Object

An object with the following properties:

  • item (Item):

    the dojo.data entry this tree represents

  • isTreeNode (Boolean):

    Indicates that this is a TreeNode. Used by dijit.Tree only, should not be accessed directly.

  • label (String):

    Text of this tree node

  • _setLabelAttr
  • labelType (String):

    Specifies how to interpret the label. Can be "html" or "text".

  • isExpandable (Boolean):

    This node has children, so show the expando node (+ sign)

  • isExpanded (Boolean):

    This node is currently expanded (ie, opened)

  • state (String):

    Dynamic loading-related stuff. When an empty folder node appears, it is "NotLoaded" first, then after dojo.data query it becomes "Loading" and, finally "Loaded"

  • templateString
  • baseClass
  • cssStateNodes
  • _setTooltipAttr
  • buildRendering
  • _setIndentAttr:

    Tell this node how many levels it should be indented

  • markProcessing:

    Visually denote that tree is loading data, etc.

  • unmarkProcessing:

    Clear markup from markProcessing() call

  • _updateItemClasses:

    Set appropriate CSS classes for icon and label dom node (used to allow for item updates to change respective CSS)

  • _applyClassAndStyle:

    Set the appropriate CSS classes and styles for labels, icons and rows.

  • _updateLayout:

    Set appropriate CSS classes for this.domNode

  • _setExpando:

    Set the right image for the expando node

  • expand:

    Show my children

  • collapse:

    Collapse this node (if it's expanded)

  • indent (Integer):

    Levels from this node to the root node

  • setChildItems:

    Sets the child items of this node, removing/adding nodes from current children to match specified items[] array. Also, if this.persist == true, expands any children that were previously opened.

  • getTreePath
  • getIdentity
  • removeChild
  • makeExpandable:

    if this node wasn't already showing the expando node, turn it into one and call _setExpando()

  • setSelected:

    A Tree has a (single) currently selected node. Mark that this node is/isn't that currently selected node.

  • focus
  • onClick:

    Connect to this function to receive notifications of mouse click events.

  • onDblClick:

    Connect to this function to receive notifications of mouse double click events.

  • onKeyDown:

    Connect to this function to receive notifications of keys being pressed down.

  • onKeyPress:

    Connect to this function to receive notifications of printable keys being typed.

  • onKeyUp:

    Connect to this function to receive notifications of keys being released.

  • onMouseDown:

    Connect to this function to receive notifications of when the mouse button is pressed down.

  • onMouseMove:

    Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget.

  • onMouseOut:

    Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget.

  • onMouseOver:

    Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget.

  • onMouseLeave:

    Connect to this function to receive notifications of when the mouse moves off of this widget.

  • onMouseEnter:

    Connect to this function to receive notifications of when the mouse moves onto this widget.

  • onMouseUp:

    Connect to this function to receive notifications of when the mouse button is released.

  • postCreate
  • on
  • _setFocusedAttr
  • setAttribute:

    Deprecated. Use set() instead.

  • attr:

    This method is deprecated, use get() or set() directly.

  • getDescendants:

    Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode. This method should generally be avoided as it returns widgets declared in templates, which are supposed to be internal/hidden, but it's left here for back-compat reasons.

  • _onShow:

    Internal method called when this widget is made visible. See onShow for details.

  • onShow:

    Called when this widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.

    Also called to indicate display of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane.

  • onHide:

    Called when another widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.

    Also called to indicate hide of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane.

  • onClose:

    Called when this widget is being displayed as a popup (ex: a Calendar popped up from a DateTextBox), and it is hidden. This is called from the dijit.popup code, and should not be called directly.

    Also used as a parameter for children of dijit/layout/StackContainer or subclasses. Callback if a user tries to close the child. Child will be closed if this function returns true.

  • id (String):

    A unique, opaque ID string that can be assigned by users or by the system. If the developer passes an ID which is known not to be unique, the specified ID is ignored and the system-generated ID is used instead.

  • _setIdAttr
  • lang (String):

    Rarely used. Overrides the default Dojo locale used to render this widget, as defined by the HTML LANG attribute. Value must be among the list of locales specified during by the Dojo bootstrap, formatted according to RFC 3066 (like en-us).

  • _setLangAttr
  • dir (String):

    Bi-directional support, as defined by the HTML DIR attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's default direction.

  • _setDirAttr
  • class
  • _setClassAttr
  • _setTypeAttr
  • style (String||Object):

    HTML style attributes as cssText string or name/value hash

  • title (String):

    HTML title attribute.

    For form widgets this specifies a tooltip to display when hovering over the widget (just like the native HTML title attribute).

    For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer, etc., it's used to specify the tab label, accordion pane title, etc. In this case it's interpreted as HTML.

  • tooltip (String):

    When this widget's title attribute is used to for a tab label, accordion pane title, etc., this specifies the tooltip to appear when the mouse is hovered over that text.

  • srcNodeRef (DomNode):

    pointer to original DOM node

  • domNode (DomNode):

    This is our visible representation of the widget! Other DOM Nodes may by assigned to other properties, usually through the template system's data-dojo-attach-point syntax, but the domNode property is the canonical "top level" node in widget UI.

  • containerNode (DomNode):

    Designates where children of the source DOM node will be placed. "Children" in this case refers to both DOM nodes and widgets. For example, for myWidget:

    1
    2
    3
    4
    5
    <div data-dojo-type=myWidget>
        <b> here's a plain DOM node
        <span data-dojo-type=subWidget>and a widget</span>
        <i> and another plain DOM node </i>
    </div>

    containerNode would point to:

    1
    2
    3
    <b> here's a plain DOM node
    <span data-dojo-type=subWidget>and a widget</span>
    <i> and another plain DOM node </i>

    In templated widgets, "containerNode" is set via a data-dojo-attach-point assignment.

    containerNode must be defined for any widget that accepts innerHTML (like ContentPane or BorderContainer or even Button), and conversely is null for widgets that don't, like TextBox.

  • ownerDocument (Document?, optional):

    The document this widget belongs to. If not specified to constructor, will default to srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global

  • _setOwnerDocumentAttr
  • _started (Boolean):

    startup() has completed.

  • attributeMap (Object):

    Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute for each XXX attribute to be mapped to the DOM.

    attributeMap sets up a "binding" between attributes (aka properties) of the widget and the widget's DOM. Changes to widget attributes listed in attributeMap will be reflected into the DOM.

    For example, calling set('title', 'hello') on a TitlePane will automatically cause the TitlePane's DOM to update with the new title.

    attributeMap is a hash where the key is an attribute of the widget, and the value reflects a binding to a:

    • DOM node attribute

      focus: {node: "focusNode", type: "attribute"} Maps this.focus to this.focusNode.focus

    • DOM node innerHTML

      title: { node: "titleNode", type: "innerHTML" } Maps this.title to this.titleNode.innerHTML

    • DOM node innerText

      title: { node: "titleNode", type: "innerText" } Maps this.title to this.titleNode.innerText

    • DOM node CSS class

      myClass: { node: "domNode", type: "class" } Maps this.myClass to this.domNode.className

    If the value is an array, then each element in the array matches one of the formats of the above list.

    There are also some shorthands for backwards compatibility:

    • string --> { node: string, type: "attribute" }, for example:
    1
    "focusNode" ---> { node: "focusNode", type: "attribute" }
    • "" --> { node: "domNode", type: "attribute" }
  • _blankGif (String):

    Path to a blank 1x1 image. Used by <img> nodes in templates that really get their image via CSS background-image.

  • _introspect:

    Collect metadata about this widget (only once per class, not once per instance):

    1
    2
    - list of attributes with custom setters, storing in this.constructor._setterAttrs
    - generate this.constructor._onMap, mapping names like "mousedown" to functions like onMouseDown
  • postscript:

    Kicks off widget instantiation. See create() for details.

  • create:

    Kick off the life-cycle of a widget

  • _applyAttributes:

    Step during widget creation to copy widget attributes to the DOM according to attributeMap and _setXXXAttr objects, and also to call custom _setXXXAttr() methods.

    Skips over blank/false attribute values, unless they were explicitly specified as parameters to the widget, since those are the default anyway, and setting tabIndex="" is different than not setting tabIndex at all.

    For backwards-compatibility reasons attributeMap overrides _setXXXAttr when _setXXXAttr is a hash/string/array, but _setXXXAttr as a functions override attributeMap.

  • postMixInProperties:

    Called after the parameters to the widget have been read-in, but before the widget template is instantiated. Especially useful to set properties that are referenced in the widget template.

  • startup:

    Processing after the DOM fragment is added to the document

  • destroyRecursive:

    Destroy this widget and its descendants

  • destroy:

    Destroy this widget, but not its descendants. Descendants means widgets inside of this.containerNode. Will also destroy any resources (including widgets) registered via this.own().

    This method will also destroy internal widgets such as those created from a template, assuming those widgets exist inside of this.domNode but outside of this.containerNode.

    For 2.0 it's planned that this method will also destroy descendant widgets, so apps should not depend on the current ability to destroy a widget without destroying its descendants. Generally they should use destroyRecursive() for widgets with children.

  • destroyRendering:

    Destroys the DOM nodes associated with this widget.

  • destroyDescendants:

    Recursively destroy the children of this widget and their descendants.

  • uninitialize:

    Deprecated. Override destroy() instead to implement custom widget tear-down behavior.

  • _setStyleAttr:

    Sets the style attribute of the widget according to value, which is either a hash like {height: "5px", width: "3px"} or a plain string

  • _attrToDom:

    Reflect a widget attribute (title, tabIndex, duration etc.) to the widget DOM, as specified by commands parameter. If commands isn't specified then it's looked up from attributeMap. Note some attributes like "type" cannot be processed this way as they are not mutable.

  • get:

    Get a property from a widget.

  • set:

    Set a property on a widget

  • _attrPairNames
  • _getAttrNames:

    Helper function for get() and set(). Caches attribute name values so we don't do the string ops every time.

  • _set:

    Helper function to set new value for specified property, and call handlers registered with watch() if the value has changed.

  • _get:

    Helper function to get value for specified property stored by this._set(), i.e. for properties with custom setters. Used mainly by custom getters.

    For example, CheckBox._getValueAttr() calls this._get("value").

  • emit:

    Used by widgets to signal that a synthetic event occurred, ex:

    1
    myWidget.emit("attrmodified-selectedChildWidget", {}).

    Emits an event on this.domNode named type.toLowerCase(), based on eventObj. Also calls onType() method, if present, and returns value from that method. By default passes eventObj to callback, but will pass callbackArgs instead, if specified. Modifies eventObj by adding missing parameters (bubbles, cancelable, widget).

  • _onMap:

    Maps on() type parameter (ex: "mousemove") to method name (ex: "onMouseMove"). If type is a synthetic event like touch.press then returns undefined.

  • toString:

    Returns a string that represents the widget.

  • getChildren:

    Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent is this widget. Note that it does not return all descendants, but rather just direct children. Analogous to Node.childNodes, except containing widgets rather than DOMNodes.

    The result intentionally excludes internally created widgets (a.k.a. supporting widgets) outside of this.containerNode.

    Note that the array returned is a simple array. Application code should not assume existence of methods like forEach().

  • getParent:

    Returns the parent widget of this widget.

  • connect:

    Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead.

    Connects specified obj/event to specified method of this object and registers for disconnect() on widget destroy.

    Provide widget-specific analog to dojo.connect, except with the implicit use of this widget as the target object. Events connected with this.connect are disconnected upon destruction.

  • disconnect:

    Deprecated, will be removed in 2.0, use handle.remove() instead.

    Disconnects handle created by connect.

  • subscribe:

    Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead.

    Subscribes to the specified topic and calls the specified method of this object and registers for unsubscribe() on widget destroy.

    Provide widget-specific analog to dojo.subscribe, except with the implicit use of this widget as the target object.

  • unsubscribe:

    Deprecated, will be removed in 2.0, use handle.remove() instead.

    Unsubscribes handle created by this.subscribe. Also removes handle from this widget's list of subscriptions

  • isLeftToRight:

    Return this widget's explicit or implicit orientation (true for LTR, false for RTL)

  • isFocusable:

    Return true if this widget can currently be focused and false if not

  • placeAt:

    Place this widget somewhere in the DOM based on standard domConstruct.place() conventions.

  • defer:

    Wrapper to setTimeout to avoid deferred functions executing after the originating widget has been destroyed. Returns an object handle with a remove method (that returns null) (replaces clearTimeout).

  • _changeAttrValue:

    Internal helper for directly changing an attribute value.

  • watch:

    Watches a property for changes

  • own:

    Track specified handles and remove/destroy them when this instance is destroyed, unless they were already removed/destroyed manually.

  • focused (Boolean):

    This widget or a widget it contains has focus, or is "active" because it was recently clicked.

  • onFocus:

    Called when the widget becomes "active" because it or a widget inside of it either has focus, or has recently been clicked.

  • onBlur:

    Called when the widget stops being "active" because focus moved to something outside of it, or the user clicked somewhere outside of it, or the widget was hidden.

  • _onFocus:

    This is where widgets do processing for when they are active, such as changing CSS classes. See onFocus() for more details.

  • _onBlur:

    This is where widgets do processing for when they stop being active, such as changing CSS classes. See onBlur() for more details.

  • _focusManager
  • templatePath (String):

    Path to template (HTML file) for this widget relative to dojo.baseUrl. Deprecated: use templateString with require([... "dojo/text!..."], ...) instead

  • _skipNodeCache
  • _rendered (Boolean):

    Not normally use, but this flag can be set by the app if the server has already rendered the template, i.e. already inlining the template for the widget into the main page. Reduces _TemplatedMixin to just function like _AttachMixin.

  • searchContainerNode
  • _stringRepl:

    Does substitution of ${foo} type properties in template string

  • _escapeValue:

    Escape a value to be inserted into the template, either into an attribute value (ex: foo="${bar}") or as inner text of an element (ex: ${foo})

  • _fillContent:

    Relocate source contents to templated container node. this.containerNode must be able to receive children, or exceptions will be thrown.

  • _attachPoints (String[]):

    List of widget attribute names associated with data-dojo-attach-point=... in the template, ex: ["containerNode", "labelNode"]

  • _attachEvents (Handle[]):

    List of connections associated with data-dojo-attach-event=... in the template

  • attachScope (Object):

    Object to which attach points and events will be scoped. Defaults to 'this'.

  • _beforeFillContent
  • _attachTemplateNodes:

    Iterate through the dom nodes and attach functions and nodes accordingly.

  • _processTemplateNode:

    Process data-dojo-attach-point and data-dojo-attach-event for given node or widget. Returns true if caller should process baseNode's children too.

  • _attach:

    Roughly corresponding to dojo/on, this is the default function for processing a data-dojo-attach-event. Meant to attach to DOMNodes, not to widgets.

  • _detachTemplateNodes:

    Detach and clean up the attachments made in _attachtempalteNodes.

  • addChild:

    Makes the given widget a child of this widget.

  • hasChildren:

    Returns true if widget has child widgets, i.e. if this.containerNode contains widgets.

  • _getSiblingOfChild:

    Get the next or previous widget sibling of child

  • getIndexOfChild:

    Gets the index of the child in this container or -1 if not found

  • _getSibling:

    Returns next or previous sibling

  • getPreviousSibling:

    Returns null if this is the first child of the parent, otherwise returns the next element sibling to the "left".

  • getNextSibling:

    Returns null if this is the last child of the parent, otherwise returns the next element sibling to the "right".

  • getIndexInParent:

    Returns the index of this widget within its container parent. It returns -1 if the parent does not exist, or if the parent is not a dijit/_Container

  • hovering (Boolean):

    True if cursor is over this widget

  • active (Boolean):

    True if mouse was pressed while over this widget, and hasn't been released yet

  • _cssMouseEvent:

    Handler for CSS event on this.domNode. Sets hovering and active properties depending on mouse state, which triggers _setStateClass() to set appropriate CSS classes for this.domNode.

  • _setStateClass:

    Update the visual state of the widget by setting the css classes on this.domNode (or this.stateNode if defined) by combining this.baseClass with various suffixes that represent the current widget state(s).

  • _subnodeCssMouseEvent:

    Handler for hover/active mouse event on widget's subnode

  • _trackMouseState:

    Track mouse/focus events on specified node and set CSS class on that node to indicate current state. Usually not called directly, but via cssStateNodes attribute.

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onBlur()
Defined by: dijit/_FocusMixin

Called when the widget stops being "active" because focus moved to something outside of it, or the user clicked somewhere outside of it, or the widget was hidden.

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onClick(item,node,evt)
Defined by: dijit/Tree

Callback when a tree node is clicked

Parameter Type Description
item Object

Object from the dojo/store corresponding to this TreeNode

node Object

The TreeNode itself

evt Event

The event

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onClose(item,node)
Defined by: dijit/Tree

Callback when a node is closed

Parameter Type Description
item Object

Object from the dojo/store corresponding to this TreeNode

node Object

The TreeNode itself

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onDblClick(item,node,evt)
Defined by: dijit/Tree

Callback when a tree node is double-clicked

Parameter Type Description
item Object

Object from the dojo/store corresponding to this TreeNode

node Object

The TreeNode itself

evt Event

The event

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onFocus()
Defined by: dijit/_FocusMixin

Called when the widget becomes "active" because it or a widget inside of it either has focus, or has recently been clicked.

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onHide()
Defined by: dijit/_Widget

Called when another widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.

Also called to indicate hide of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane.

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onKeyboardSearch(item,evt,searchString,numMatches)
Defined by: dijit/_KeyNavMixin

When a key is pressed that matches a child item, this method is called so that a widget can take appropriate action is necessary.

Parameter Type Description
item dijit/_WidgetBase
evt Event
searchString String
numMatches Number

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onKeyDown(event)
Defined by: dijit/_Widget

Connect to this function to receive notifications of keys being pressed down.

Parameter Type Description
event undefined

key Event

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onKeyPress(event)
Defined by: dijit/_Widget

Connect to this function to receive notifications of printable keys being typed.

Parameter Type Description
event undefined

key Event

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onKeyUp(event)
Defined by: dijit/_Widget

Connect to this function to receive notifications of keys being released.

Parameter Type Description
event undefined

key Event

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onLoad()
Defined by: dijit/Tree

Called when tree finishes loading and expanding.

If persist == true the loading may encompass many levels of fetches from the data store, each asynchronous. Waits for all to finish.

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onMouseDown(event)
Defined by: dijit/_Widget

Connect to this function to receive notifications of when the mouse button is pressed down.

Parameter Type Description
event undefined

mouse Event

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onMouseEnter(event)
Defined by: dijit/_Widget

Connect to this function to receive notifications of when the mouse moves onto this widget.

Parameter Type Description
event undefined

mouse Event

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onMouseLeave(event)
Defined by: dijit/_Widget

Connect to this function to receive notifications of when the mouse moves off of this widget.

Parameter Type Description
event undefined

mouse Event

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onMouseMove(event)
Defined by: dijit/_Widget

Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget.

Parameter Type Description
event undefined

mouse Event

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onMouseOut(event)
Defined by: dijit/_Widget

Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget.

Parameter Type Description
event undefined

mouse Event

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onMouseOver(event)
Defined by: dijit/_Widget

Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget.

Parameter Type Description
event undefined

mouse Event

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onMouseUp(event)
Defined by: dijit/_Widget

Connect to this function to receive notifications of when the mouse button is released.

Parameter Type Description
event undefined

mouse Event

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onOpen(item,node)
Defined by: dijit/Tree

Callback when a node is opened

Parameter Type Description
item dojo/data/Item
node Object

An object with the following properties:

  • item (Item):

    the dojo.data entry this tree represents

  • isTreeNode (Boolean):

    Indicates that this is a TreeNode. Used by dijit.Tree only, should not be accessed directly.

  • label (String):

    Text of this tree node

  • _setLabelAttr
  • labelType (String):

    Specifies how to interpret the label. Can be "html" or "text".

  • isExpandable (Boolean):

    This node has children, so show the expando node (+ sign)

  • isExpanded (Boolean):

    This node is currently expanded (ie, opened)

  • state (String):

    Dynamic loading-related stuff. When an empty folder node appears, it is "NotLoaded" first, then after dojo.data query it becomes "Loading" and, finally "Loaded"

  • templateString
  • baseClass
  • cssStateNodes
  • _setTooltipAttr
  • buildRendering
  • _setIndentAttr:

    Tell this node how many levels it should be indented

  • markProcessing:

    Visually denote that tree is loading data, etc.

  • unmarkProcessing:

    Clear markup from markProcessing() call

  • _updateItemClasses:

    Set appropriate CSS classes for icon and label dom node (used to allow for item updates to change respective CSS)

  • _applyClassAndStyle:

    Set the appropriate CSS classes and styles for labels, icons and rows.

  • _updateLayout:

    Set appropriate CSS classes for this.domNode

  • _setExpando:

    Set the right image for the expando node

  • expand:

    Show my children

  • collapse:

    Collapse this node (if it's expanded)

  • indent (Integer):

    Levels from this node to the root node

  • setChildItems:

    Sets the child items of this node, removing/adding nodes from current children to match specified items[] array. Also, if this.persist == true, expands any children that were previously opened.

  • getTreePath
  • getIdentity
  • removeChild
  • makeExpandable:

    if this node wasn't already showing the expando node, turn it into one and call _setExpando()

  • setSelected:

    A Tree has a (single) currently selected node. Mark that this node is/isn't that currently selected node.

  • focus
  • onClick:

    Connect to this function to receive notifications of mouse click events.

  • onDblClick:

    Connect to this function to receive notifications of mouse double click events.

  • onKeyDown:

    Connect to this function to receive notifications of keys being pressed down.

  • onKeyPress:

    Connect to this function to receive notifications of printable keys being typed.

  • onKeyUp:

    Connect to this function to receive notifications of keys being released.

  • onMouseDown:

    Connect to this function to receive notifications of when the mouse button is pressed down.

  • onMouseMove:

    Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget.

  • onMouseOut:

    Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget.

  • onMouseOver:

    Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget.

  • onMouseLeave:

    Connect to this function to receive notifications of when the mouse moves off of this widget.

  • onMouseEnter:

    Connect to this function to receive notifications of when the mouse moves onto this widget.

  • onMouseUp:

    Connect to this function to receive notifications of when the mouse button is released.

  • postCreate
  • on
  • _setFocusedAttr
  • setAttribute:

    Deprecated. Use set() instead.

  • attr:

    This method is deprecated, use get() or set() directly.

  • getDescendants:

    Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode. This method should generally be avoided as it returns widgets declared in templates, which are supposed to be internal/hidden, but it's left here for back-compat reasons.

  • _onShow:

    Internal method called when this widget is made visible. See onShow for details.

  • onShow:

    Called when this widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.

    Also called to indicate display of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane.

  • onHide:

    Called when another widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.

    Also called to indicate hide of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane.

  • onClose:

    Called when this widget is being displayed as a popup (ex: a Calendar popped up from a DateTextBox), and it is hidden. This is called from the dijit.popup code, and should not be called directly.

    Also used as a parameter for children of dijit/layout/StackContainer or subclasses. Callback if a user tries to close the child. Child will be closed if this function returns true.

  • id (String):

    A unique, opaque ID string that can be assigned by users or by the system. If the developer passes an ID which is known not to be unique, the specified ID is ignored and the system-generated ID is used instead.

  • _setIdAttr
  • lang (String):

    Rarely used. Overrides the default Dojo locale used to render this widget, as defined by the HTML LANG attribute. Value must be among the list of locales specified during by the Dojo bootstrap, formatted according to RFC 3066 (like en-us).

  • _setLangAttr
  • dir (String):

    Bi-directional support, as defined by the HTML DIR attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's default direction.

  • _setDirAttr
  • class
  • _setClassAttr
  • _setTypeAttr
  • style (String||Object):

    HTML style attributes as cssText string or name/value hash

  • title (String):

    HTML title attribute.

    For form widgets this specifies a tooltip to display when hovering over the widget (just like the native HTML title attribute).

    For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer, etc., it's used to specify the tab label, accordion pane title, etc. In this case it's interpreted as HTML.

  • tooltip (String):

    When this widget's title attribute is used to for a tab label, accordion pane title, etc., this specifies the tooltip to appear when the mouse is hovered over that text.

  • srcNodeRef (DomNode):

    pointer to original DOM node

  • domNode (DomNode):

    This is our visible representation of the widget! Other DOM Nodes may by assigned to other properties, usually through the template system's data-dojo-attach-point syntax, but the domNode property is the canonical "top level" node in widget UI.

  • containerNode (DomNode):

    Designates where children of the source DOM node will be placed. "Children" in this case refers to both DOM nodes and widgets. For example, for myWidget:

    1
    2
    3
    4
    5
    <div data-dojo-type=myWidget>
        <b> here's a plain DOM node
        <span data-dojo-type=subWidget>and a widget</span>
        <i> and another plain DOM node </i>
    </div>

    containerNode would point to:

    1
    2
    3
    <b> here's a plain DOM node
    <span data-dojo-type=subWidget>and a widget</span>
    <i> and another plain DOM node </i>

    In templated widgets, "containerNode" is set via a data-dojo-attach-point assignment.

    containerNode must be defined for any widget that accepts innerHTML (like ContentPane or BorderContainer or even Button), and conversely is null for widgets that don't, like TextBox.

  • ownerDocument (Document?, optional):

    The document this widget belongs to. If not specified to constructor, will default to srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global

  • _setOwnerDocumentAttr
  • _started (Boolean):

    startup() has completed.

  • attributeMap (Object):

    Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute for each XXX attribute to be mapped to the DOM.

    attributeMap sets up a "binding" between attributes (aka properties) of the widget and the widget's DOM. Changes to widget attributes listed in attributeMap will be reflected into the DOM.

    For example, calling set('title', 'hello') on a TitlePane will automatically cause the TitlePane's DOM to update with the new title.

    attributeMap is a hash where the key is an attribute of the widget, and the value reflects a binding to a:

    • DOM node attribute

      focus: {node: "focusNode", type: "attribute"} Maps this.focus to this.focusNode.focus

    • DOM node innerHTML

      title: { node: "titleNode", type: "innerHTML" } Maps this.title to this.titleNode.innerHTML

    • DOM node innerText

      title: { node: "titleNode", type: "innerText" } Maps this.title to this.titleNode.innerText

    • DOM node CSS class

      myClass: { node: "domNode", type: "class" } Maps this.myClass to this.domNode.className

    If the value is an array, then each element in the array matches one of the formats of the above list.

    There are also some shorthands for backwards compatibility:

    • string --> { node: string, type: "attribute" }, for example:
    1
    "focusNode" ---> { node: "focusNode", type: "attribute" }
    • "" --> { node: "domNode", type: "attribute" }
  • _blankGif (String):

    Path to a blank 1x1 image. Used by <img> nodes in templates that really get their image via CSS background-image.

  • _introspect:

    Collect metadata about this widget (only once per class, not once per instance):

    1
    2
    - list of attributes with custom setters, storing in this.constructor._setterAttrs
    - generate this.constructor._onMap, mapping names like "mousedown" to functions like onMouseDown
  • postscript:

    Kicks off widget instantiation. See create() for details.

  • create:

    Kick off the life-cycle of a widget

  • _applyAttributes:

    Step during widget creation to copy widget attributes to the DOM according to attributeMap and _setXXXAttr objects, and also to call custom _setXXXAttr() methods.

    Skips over blank/false attribute values, unless they were explicitly specified as parameters to the widget, since those are the default anyway, and setting tabIndex="" is different than not setting tabIndex at all.

    For backwards-compatibility reasons attributeMap overrides _setXXXAttr when _setXXXAttr is a hash/string/array, but _setXXXAttr as a functions override attributeMap.

  • postMixInProperties:

    Called after the parameters to the widget have been read-in, but before the widget template is instantiated. Especially useful to set properties that are referenced in the widget template.

  • startup:

    Processing after the DOM fragment is added to the document

  • destroyRecursive:

    Destroy this widget and its descendants

  • destroy:

    Destroy this widget, but not its descendants. Descendants means widgets inside of this.containerNode. Will also destroy any resources (including widgets) registered via this.own().

    This method will also destroy internal widgets such as those created from a template, assuming those widgets exist inside of this.domNode but outside of this.containerNode.

    For 2.0 it's planned that this method will also destroy descendant widgets, so apps should not depend on the current ability to destroy a widget without destroying its descendants. Generally they should use destroyRecursive() for widgets with children.

  • destroyRendering:

    Destroys the DOM nodes associated with this widget.

  • destroyDescendants:

    Recursively destroy the children of this widget and their descendants.

  • uninitialize:

    Deprecated. Override destroy() instead to implement custom widget tear-down behavior.

  • _setStyleAttr:

    Sets the style attribute of the widget according to value, which is either a hash like {height: "5px", width: "3px"} or a plain string

  • _attrToDom:

    Reflect a widget attribute (title, tabIndex, duration etc.) to the widget DOM, as specified by commands parameter. If commands isn't specified then it's looked up from attributeMap. Note some attributes like "type" cannot be processed this way as they are not mutable.

  • get:

    Get a property from a widget.

  • set:

    Set a property on a widget

  • _attrPairNames
  • _getAttrNames:

    Helper function for get() and set(). Caches attribute name values so we don't do the string ops every time.

  • _set:

    Helper function to set new value for specified property, and call handlers registered with watch() if the value has changed.

  • _get:

    Helper function to get value for specified property stored by this._set(), i.e. for properties with custom setters. Used mainly by custom getters.

    For example, CheckBox._getValueAttr() calls this._get("value").

  • emit:

    Used by widgets to signal that a synthetic event occurred, ex:

    1
    myWidget.emit("attrmodified-selectedChildWidget", {}).

    Emits an event on this.domNode named type.toLowerCase(), based on eventObj. Also calls onType() method, if present, and returns value from that method. By default passes eventObj to callback, but will pass callbackArgs instead, if specified. Modifies eventObj by adding missing parameters (bubbles, cancelable, widget).

  • _onMap:

    Maps on() type parameter (ex: "mousemove") to method name (ex: "onMouseMove"). If type is a synthetic event like touch.press then returns undefined.

  • toString:

    Returns a string that represents the widget.

  • getChildren:

    Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent is this widget. Note that it does not return all descendants, but rather just direct children. Analogous to Node.childNodes, except containing widgets rather than DOMNodes.

    The result intentionally excludes internally created widgets (a.k.a. supporting widgets) outside of this.containerNode.

    Note that the array returned is a simple array. Application code should not assume existence of methods like forEach().

  • getParent:

    Returns the parent widget of this widget.

  • connect:

    Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead.

    Connects specified obj/event to specified method of this object and registers for disconnect() on widget destroy.

    Provide widget-specific analog to dojo.connect, except with the implicit use of this widget as the target object. Events connected with this.connect are disconnected upon destruction.

  • disconnect:

    Deprecated, will be removed in 2.0, use handle.remove() instead.

    Disconnects handle created by connect.

  • subscribe:

    Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead.

    Subscribes to the specified topic and calls the specified method of this object and registers for unsubscribe() on widget destroy.

    Provide widget-specific analog to dojo.subscribe, except with the implicit use of this widget as the target object.

  • unsubscribe:

    Deprecated, will be removed in 2.0, use handle.remove() instead.

    Unsubscribes handle created by this.subscribe. Also removes handle from this widget's list of subscriptions

  • isLeftToRight:

    Return this widget's explicit or implicit orientation (true for LTR, false for RTL)

  • isFocusable:

    Return true if this widget can currently be focused and false if not

  • placeAt:

    Place this widget somewhere in the DOM based on standard domConstruct.place() conventions.

  • defer:

    Wrapper to setTimeout to avoid deferred functions executing after the originating widget has been destroyed. Returns an object handle with a remove method (that returns null) (replaces clearTimeout).

  • _changeAttrValue:

    Internal helper for directly changing an attribute value.

  • watch:

    Watches a property for changes

  • own:

    Track specified handles and remove/destroy them when this instance is destroyed, unless they were already removed/destroyed manually.

  • focused (Boolean):

    This widget or a widget it contains has focus, or is "active" because it was recently clicked.

  • onFocus:

    Called when the widget becomes "active" because it or a widget inside of it either has focus, or has recently been clicked.

  • onBlur:

    Called when the widget stops being "active" because focus moved to something outside of it, or the user clicked somewhere outside of it, or the widget was hidden.

  • _onFocus:

    This is where widgets do processing for when they are active, such as changing CSS classes. See onFocus() for more details.

  • _onBlur:

    This is where widgets do processing for when they stop being active, such as changing CSS classes. See onBlur() for more details.

  • _focusManager
  • templatePath (String):

    Path to template (HTML file) for this widget relative to dojo.baseUrl. Deprecated: use templateString with require([... "dojo/text!..."], ...) instead

  • _skipNodeCache
  • _rendered (Boolean):

    Not normally use, but this flag can be set by the app if the server has already rendered the template, i.e. already inlining the template for the widget into the main page. Reduces _TemplatedMixin to just function like _AttachMixin.

  • searchContainerNode
  • _stringRepl:

    Does substitution of ${foo} type properties in template string

  • _escapeValue:

    Escape a value to be inserted into the template, either into an attribute value (ex: foo="${bar}") or as inner text of an element (ex: ${foo})

  • _fillContent:

    Relocate source contents to templated container node. this.containerNode must be able to receive children, or exceptions will be thrown.

  • _attachPoints (String[]):

    List of widget attribute names associated with data-dojo-attach-point=... in the template, ex: ["containerNode", "labelNode"]

  • _attachEvents (Handle[]):

    List of connections associated with data-dojo-attach-event=... in the template

  • attachScope (Object):

    Object to which attach points and events will be scoped. Defaults to 'this'.

  • _beforeFillContent
  • _attachTemplateNodes:

    Iterate through the dom nodes and attach functions and nodes accordingly.

  • _processTemplateNode:

    Process data-dojo-attach-point and data-dojo-attach-event for given node or widget. Returns true if caller should process baseNode's children too.

  • _attach:

    Roughly corresponding to dojo/on, this is the default function for processing a data-dojo-attach-event. Meant to attach to DOMNodes, not to widgets.

  • _detachTemplateNodes:

    Detach and clean up the attachments made in _attachtempalteNodes.

  • addChild:

    Makes the given widget a child of this widget.

  • hasChildren:

    Returns true if widget has child widgets, i.e. if this.containerNode contains widgets.

  • _getSiblingOfChild:

    Get the next or previous widget sibling of child

  • getIndexOfChild:

    Gets the index of the child in this container or -1 if not found

  • _getSibling:

    Returns next or previous sibling

  • getPreviousSibling:

    Returns null if this is the first child of the parent, otherwise returns the next element sibling to the "left".

  • getNextSibling:

    Returns null if this is the last child of the parent, otherwise returns the next element sibling to the "right".

  • getIndexInParent:

    Returns the index of this widget within its container parent. It returns -1 if the parent does not exist, or if the parent is not a dijit/_Container

  • hovering (Boolean):

    True if cursor is over this widget

  • active (Boolean):

    True if mouse was pressed while over this widget, and hasn't been released yet

  • _cssMouseEvent:

    Handler for CSS event on this.domNode. Sets hovering and active properties depending on mouse state, which triggers _setStateClass() to set appropriate CSS classes for this.domNode.

  • _setStateClass:

    Update the visual state of the widget by setting the css classes on this.domNode (or this.stateNode if defined) by combining this.baseClass with various suffixes that represent the current widget state(s).

  • _subnodeCssMouseEvent:

    Handler for hover/active mouse event on widget's subnode

  • _trackMouseState:

    Track mouse/focus events on specified node and set CSS class on that node to indicate current state. Usually not called directly, but via cssStateNodes attribute.

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onShow()
Defined by: dijit/_Widget

Called when this widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.

Also called to indicate display of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane.

Examples

Example 1

1
2
3
4
5
6
var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
Error in the documentation? Can’t find what you are looking for? Let us know!