dojox/treemap/TreeMap (version 1.10)

dijit/_WidgetBase, dojox/widget/_Invalidating, dojox/widget/Selection

Summary

A treemap widget.

Usage

var foo = new TreeMap();
dojox/treemap/TreeMap

See the dojox/treemap/TreeMap reference documentation for more information.

Property Summary

  • _areaChanged
  • _attrPairNames
  • _blankGifPath to a blank 1x1 image.
  • _coloringChanged
  • _dataChanged
  • _groupFuncs
  • _groupingChanged
  • _rootItemChanged
  • _setClassAttr
  • _setDirAttr
  • _setIdAttr
  • _setLangAttr
  • _setTypeAttr
  • _startedstartup() has completed.
  • areaAttrThe attribute of the store item that contains the data used to compute the area of a treemap cell.Default is "".
  • attributeMapDeprecated.
  • baseClass
  • class
  • colorAttrThe attribute of the store item that contains the data used to compute the color of a treemap cell.
  • colorModelThe optional color model that converts data to color.Default is null.
  • containerNodeDesignates where children of the source DOM node will be placed. "Children" in this case refers to both DOM nodes and widgets.
  • dirBi-directional support, as defined by the HTML DIR attribute.
  • domNodeThis is our visible representation of the widget!
  • focusedThis widget or a widget it contains has focus, or is "active" because it was recently clicked.
  • groupAttrsAn array of data attributes used to group data in the treemap.Default is [].
  • groupFuncsAn array of grouping functions used to group data in the treemap.
  • idA unique, opaque ID string that can be assigned by users or by the system.
  • invalidatingProperties
  • invalidRendering
  • itemToRendererThe associated array item to renderer list.
  • labelAttrThe attribute of the store item that contains the label of a treemap cell.Default is "label".
  • labelThresholdThe starting depth level at which the labels are not displayed anymore on cells.If NaN no threshold is applied.
  • langRarely used.
  • ownerDocumentThe document this widget belongs to.
  • queryA query that can be passed to when querying the store.
  • queryOptionsOptions to be applied when querying the store.
  • rootItemThe root item of the treemap, that is the first visible item.
  • selectedItemIn single selection mode, the selected item or in multiple selection mode the last selected item.
  • selectedItemsThe list of selected items.
  • selectionModeValid values are: "none": No selection can be done. "single": Only one item can be selected at a time. "multiple": Several item can be selected using the control key modifier.
  • srcNodeRefpointer to original DOM node
  • storeThe store that contains the items to display.
  • styleHTML style attributes as cssText string or name/value hash
  • 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.
  • tooltipAttrThe attribute of the store item that contains the tooltip text of a treemap cell.Default is "".

Method Summary

  • _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.
  • _attrToDom(attr,value,commands) Reflect a widget attribute (title, tabIndex, duration etc.) to the widget DOM, as specified by commands parameter.
  • _buildChildrenRenderers(domNode,item,level,forceCreate,delta,anim)
  • _buildRenderer(container,parent,child,rect,level,forceCreate,anim)
  • _changeAttrValue(name,value) Internal helper for directly changing an attribute value.
  • _computeAreaForItem(item)
  • _cv(s)
  • _get(name) Helper function to get value for specified property stored by this._set(), i.e. for properties with custom setters.
  • _getAreaForItem(item)
  • _getAttrNames(name) Helper function for get() and set().
  • _getRenderer(item,anim,parent)
  • _getRendererFromTarget(target)
  • _getSelectedItemsAttr()
  • _initItems(items)
  • _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
  • _isLeaf(item)
  • _isRoot(item)
  • _layoutGroupContent(renderer,width,height,level,forceCreate,anim)
  • _removeAreaForGroup(item)
  • _set(name,value) Helper function to set new value for specified property, and call handlers registered with watch() if the value has changed.
  • _setAreaAttrAttr(value)
  • _setAreaFuncAttr(value)
  • _setColorAttrAttr(value)
  • _setColorFuncAttr(value)
  • _setColorModelAttr(value)
  • _setGroupAttrsAttr(value)
  • _setGroupFuncsAttr(value)
  • _setOwnerDocumentAttr(val)
  • _setRootItemAttr(value)
  • _setSelectedItemAttr(value)
  • _setSelectedItemsAttr(value)
  • _setSelectionModeAttr(value)
  • _setStoreAttr(value)
  • _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
  • _setValidAttr(value)
  • _updateGroupContentRenderer(renderer,item,level) Update a group content renderer.
  • _updateGroupRenderer(renderer,item,level) Update a group renderer.
  • _updateHeaderRenderer(renderer,item,level) Update a leaf renderer.
  • _updateItem(item,previousIndex,newIndex)
  • _updateLeafRenderer(renderer,item,level) Update a leaf renderer.
  • _updateTreeMapHierarchy()
  • addInvalidatingProperties(properties) Add properties to the watched properties to trigger invalidation.
  • areaFunc(item,store) A function that returns the value use to compute the area of cell from a store item.
  • buildRendering()
  • colorFunc(item,store) A function that returns from a store item the color value of cell or the value used by the ColorModel to compute the cell color.
  • 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
  • createRenderer(item,level,kind) Creates an item renderer of the specified kind.
  • defer(fcn,delay) Wrapper to setTimeout to avoid deferred functions executing after the originating widget has been destroyed.
  • destroy(preserveDom) Destroy this widget, but not its descendants.
  • destroyDescendants(preserveDom) Recursively destroy the children of this widget and their descendants.
  • destroyRecursive(preserveDom) Destroy this widget and its descendants
  • destroyRendering(preserveDom) Destroys the DOM nodes associated with this widget.
  • disconnect(handle) Deprecated, will be removed in 2.0, use handle.remove() instead.
  • dispatchChange(oldSelectedItem,newSelectedItem,renderer,triggerEvent) Dispatch a selection change event.
  • emit(type,eventObj,callbackArgs) Used by widgets to signal that a synthetic event occurred, ex: myWidget.emit("attrmodified-selectedChildWidget", {}).
  • 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.
  • getColorForItem(item) Returns the color for a given item.
  • getIdentity(item)
  • getLabelForItem(item) Returns the label for a given item.
  • getParent() Returns the parent widget of this widget.
  • invalidateRendering() Invalidating the rendering for the next executation frame.
  • isFocusable() Return true if this widget can currently be focused and false if not
  • isItemSelected(item) Returns whether an item is selected or not.
  • isLeftToRight() Return this widget's explicit or implicit orientation (true for LTR, false for RTL)
  • isValid()
  • labelFunc(item,store) A function that returns the label of cell from a store item.Default implementation is using labelAttr.
  • on(type,func) Call specified function when event occurs, ex: myWidget.on("click", function(){ ... }).
  • 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() Called after the parameters to the widget have been read-in, but before the widget template is instantiated.
  • postscript(params,srcNodeRef) Kicks off widget instantiation.
  • refreshRendering()
  • resize(box)
  • selectFromEvent(e,item,renderer,dispatch) Applies selection triggered by an user interaction
  • set(name,value) Set a property on a widget
  • setItemSelected(item,value) Change the selection state of an item.
  • startup() Processing after the DOM fragment is added to the document
  • styleRenderer(renderer,item,level,kind) Style the item renderer.
  • subscribe(t,method) Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead.
  • tooltipFunc(item,store) A function that returns the tooltip of cell from a store item.Default implementation is using tooltipAttr.
  • toString() Returns a string that represents the widget.
  • uninitialize() Deprecated.
  • unsubscribe(handle) Deprecated, will be removed in 2.0, use handle.remove() instead.
  • updateRenderers(items) Updates the renderer(s) that represent the specified item(s).
  • validateRendering() Immediately validate the rendering if it has been invalidated.
  • 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.
  • _onFocus() This is where widgets do processing for when they are active, such as changing CSS classes.
  • _onMap(type) Maps on() type parameter (ex: "mousemove") to method name (ex: "onMouseMove").
  • _onMouseOut(e)
  • _onMouseOver(e)
  • _onMouseUp(e)
  • 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.
  • onChange() Called when the selection changed.
  • onFocus() Called when the widget becomes "active" because it or a widget inside of it either has focus, or has recently been clicked.
  • onItemRollOut() Called when an item renderer has been rolled out.
  • onItemRollOver() Called when an item renderer has been hovered.
  • onRendererUpdated() Called when a renderer has been updated.

Properties

_areaChanged
Defined by: dojox/treemap/TreeMap
_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.

_coloringChanged
Defined by: dojox/treemap/TreeMap
_dataChanged
Defined by: dojox/treemap/TreeMap
_groupFuncs
Defined by: dojox/treemap/TreeMap
_groupingChanged
Defined by: dojox/treemap/TreeMap
_rootItemChanged
Defined by: dojox/treemap/TreeMap
_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
_started
Defined by: dijit/_WidgetBase

startup() has completed.

areaAttr
Defined by: dojox/treemap/TreeMap

The attribute of the store item that contains the data used to compute the area of a treemap cell.
Default is "".

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:
"focusNode" ---> { node: "focusNode", type: "attribute" }
  • "" --> { node: "domNode", type: "attribute" }
baseClass
Defined by: dojox/treemap/TreeMap
class
Defined by: dijit/_WidgetBase
colorAttr
Defined by: dojox/treemap/TreeMap

The attribute of the store item that contains the data used to compute the color of a treemap cell. Default is "".

colorModel
Defined by: dojox/treemap/TreeMap

The optional color model that converts data to color.
Default is null.

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:

<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:

<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.

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.

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.

focused
Defined by: dijit/_FocusMixin

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

groupAttrs
Defined by: dojox/treemap/TreeMap

An array of data attributes used to group data in the treemap.
Default is [].

groupFuncs
Defined by: dojox/treemap/TreeMap

An array of grouping functions used to group data in the treemap. When null, groupAttrs is to compute grouping functions. Default is null.

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.

invalidatingProperties
invalidRendering
itemToRenderer
Defined by: dojox/treemap/TreeMap

The associated array item to renderer list.

labelAttr
Defined by: dojox/treemap/TreeMap

The attribute of the store item that contains the label of a treemap cell.
Default is "label".

labelThreshold
Defined by: dojox/treemap/TreeMap

The starting depth level at which the labels are not displayed anymore on cells.
If NaN no threshold is applied. The depth is the visual depth of the items on the screen not in the data (i.e. after drill down the depth of an item might change). Default is NaN.

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).

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

query
Defined by: dojox/treemap/TreeMap

A query that can be passed to when querying the store.

queryOptions
Defined by: dojox/treemap/TreeMap

Options to be applied when querying the store.

rootItem
Defined by: dojox/treemap/TreeMap

The root item of the treemap, that is the first visible item. If null the entire treemap hierarchy is shown.
Default is null.

selectedItem

In single selection mode, the selected item or in multiple selection mode the last selected item. Warning: Do not use this property directly, make sure to call set() or get() methods.

selectedItems

The list of selected items. Warning: Do not use this property directly, make sure to call set() or get() methods.

selectionMode

Valid values are:

  1. "none": No selection can be done.
  2. "single": Only one item can be selected at a time.
  3. "multiple": Several item can be selected using the control key modifier. Default value is "single".
srcNodeRef
Defined by: dijit/_WidgetBase

pointer to original DOM node

store
Defined by: dojox/treemap/TreeMap

The store that contains the items to display.

style
Defined by: dijit/_WidgetBase

HTML style attributes as cssText string or name/value hash

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.

tooltipAttr
Defined by: dojox/treemap/TreeMap

The attribute of the store item that contains the tooltip text of a treemap cell.
Default is "".

Methods

_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.

_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
_buildChildrenRenderers(domNode,item,level,forceCreate,delta,anim)
Parameter Type Description
domNode undefined
item undefined
level undefined
forceCreate undefined
delta undefined
anim undefined
_buildRenderer(container,parent,child,rect,level,forceCreate,anim)
Parameter Type Description
container undefined
parent undefined
child undefined
rect undefined
level undefined
forceCreate undefined
anim undefined
_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.

_computeAreaForItem(item)
Parameter Type Description
item undefined
Returns:undefined
_cv(s)
Defined by dojox/mobile/i18n
Parameter Type Description
s undefined
Returns:undefined
_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
_getAreaForItem(item)
Parameter Type Description
item undefined
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
_getRenderer(item,anim,parent)
Parameter Type Description
item undefined
anim undefined
parent undefined
Returns:undefined
_getRendererFromTarget(target)
Parameter Type Description
target undefined
Returns:undefined
_getSelectedItemsAttr()
Returns:Array
_initItems(items)
Parameter Type Description
items undefined
Returns:undefined
_introspect()
Defined by dijit/_WidgetBase

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
_isLeaf(item)
Parameter Type Description
item undefined
Returns:boolean
_isRoot(item)
Parameter Type Description
item undefined
Returns:undefined
_layoutGroupContent(renderer,width,height,level,forceCreate,anim)
Parameter Type Description
renderer undefined
width undefined
height undefined
level undefined
forceCreate undefined
anim undefined
_removeAreaForGroup(item)
Parameter Type Description
item undefined
_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
_setAreaAttrAttr(value)
Parameter Type Description
value undefined
_setAreaFuncAttr(value)
Parameter Type Description
value undefined
_setColorAttrAttr(value)
Parameter Type Description
value undefined
_setColorFuncAttr(value)
Parameter Type Description
value undefined
_setColorModelAttr(value)
Parameter Type Description
value undefined
_setGroupAttrsAttr(value)
Parameter Type Description
value undefined
_setGroupFuncsAttr(value)
Parameter Type Description
value undefined
_setOwnerDocumentAttr(val)
Defined by dijit/_WidgetBase
Parameter Type Description
val undefined
_setRootItemAttr(value)
Parameter Type Description
value undefined
_setSelectedItemAttr(value)
Parameter Type Description
value undefined
_setSelectedItemsAttr(value)
Parameter Type Description
value undefined
_setSelectionModeAttr(value)
Parameter Type Description
value undefined
_setStoreAttr(value)
Parameter Type Description
value undefined
Returns:undefined
_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
_setValidAttr(value)
Parameter Type Description
value undefined
_updateGroupContentRenderer(renderer,item,level)

Update a group content renderer. This creates the renderer if not already created, and call styleRender for it.

Parameter Type Description
renderer undefined

The item renderer.

item Object | Array

The item(s).

level Number

The item depth level.

Returns:undefined
_updateGroupRenderer(renderer,item,level)

Update a group renderer. This creates the renderer if not already created, call styleRender for it and recurse into children.

Parameter Type Description
renderer DomNode

The item renderer.

item Object

The data item.

level Number

The item depth level.

Returns:undefined
_updateHeaderRenderer(renderer,item,level)

Update a leaf renderer. This creates the renderer if not already created, call styleRender for it and set the label as its innerHTML.

Parameter Type Description
renderer DomNode

The item renderer.

item Object

The data item.

level Number

The item depth level.

Returns:undefined
_updateItem(item,previousIndex,newIndex)
Parameter Type Description
item undefined
previousIndex undefined
newIndex undefined
_updateLeafRenderer(renderer,item,level)

Update a leaf renderer. This creates the renderer if not already created, call styleRender for it and set the label as its innerHTML.

Parameter Type Description
renderer DomNode

The item renderer.

item Object

The data item.

level Number

The item depth level.

Returns:undefined
_updateTreeMapHierarchy()
addInvalidatingProperties(properties)

Add properties to the watched properties to trigger invalidation. This method must be called in the constructor. It is typically used by subclasses of a _Invalidating class to add more properties to watch for.

Parameter Type Description
properties String[]

The list of properties to watch for.

areaFunc(item,store)

A function that returns the value use to compute the area of cell from a store item. Default implementation is using areaAttr.

Parameter Type Description
item Object
store dojo/store/api/Store
Returns:number
buildRendering()
colorFunc(item,store)

A function that returns from a store item the color value of cell or the value used by the ColorModel to compute the cell color. If a color must be returned it must be in form accepted by the dojo/_base/Color constructor. If a value must be returned it must be a Number. Default implementation is using colorAttr.

Parameter Type Description
item Object
store dojo/store/api/Store
Returns:undefined
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

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
createRenderer(item,level,kind)

Creates an item renderer of the specified kind. This is called only when the treemap is created. Default implementation always create div nodes. It also sets overflow to hidden and position to absolute on non-header renderers.

Parameter Type Description
item Object

The data item.

level Number

The item depth level.

kind String

The specified kind. This can either be "leaf", "group", "header" or "content".

Returns:DomNode | undefined

The renderer use for the specified kind.

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(preserveDom)
Defined by dijit/_WidgetBase

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.

Parameter Type Description
preserveDom Boolean

If true, this method will leave the original DOM structure alone. Note: This will not yet work with _TemplatedMixin widgets

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(preserveDom)
Defined by dijit/_WidgetBase

Destroy this widget and its descendants

This is the generic "destructor" function that all widget users should call to cleanly discard with a widget. Once a widget is destroyed, it is removed from the manager object.

Parameter Type Description
preserveDom Boolean
Optional

If true, this method will leave the original DOM structure alone of descendant Widgets. Note: This will NOT work with dijit._TemplatedMixin widgets.

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
dispatchChange(oldSelectedItem,newSelectedItem,renderer,triggerEvent)

Dispatch a selection change event.

Parameter Type Description
oldSelectedItem Object

The previously selectedItem.

newSelectedItem Object

The new selectedItem.

renderer Object

The visual renderer of the selected/deselected item.

triggerEvent Event

The event that lead to the selection of the item.

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

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

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
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
getColorForItem(item)

Returns the color for a given item. This either use the colorModel if not null or just the result of the colorFunc.

Parameter Type Description
item Object

The data item.

Returns:undefined | instance
getIdentity(item)
Parameter Type Description
item undefined
Returns:undefined
getLabelForItem(item)

Returns the label for a given item.

Parameter Type Description
item Object

The data item.

Returns:undefined
getParent()
Defined by dijit/_WidgetBase

Returns the parent widget of this widget.

Returns:undefined
invalidateRendering()

Invalidating the rendering for the next executation frame.

isFocusable()
Defined by dijit/_WidgetBase

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

Returns:undefined
isItemSelected(item)

Returns whether an item is selected or not.

Parameter Type Description
item Object

The item to test the selection for.

Returns:boolean | undefined
isLeftToRight()
Defined by dijit/_WidgetBase

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

Returns:undefined
isValid()
labelFunc(item,store)

A function that returns the label of cell from a store item.
Default implementation is using labelAttr.

Parameter Type Description
item Object
store dojo/store/api/Store
Returns:null
on(type,func)
Defined by dijit/_WidgetBase

Call specified function when event occurs, ex: myWidget.on("click", function(){ ... }).

Call specified function when event type occurs, ex: myWidget.on("click", function(){ ... }). Note that the function is not run in any particular scope, so if (for example) you want it to run in the widget's scope you must do myWidget.on("click", lang.hitch(myWidget, func)).

Parameter Type Description
type String | Function

Name of event (ex: "click") or extension event like touch.press.

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:

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

// 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

// 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

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

Example 4

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

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.

postscript(params,srcNodeRef)
Defined by dijit/_WidgetBase

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

Parameter Type Description
params Object
Optional
srcNodeRef DomNode | String
refreshRendering()
resize(box)
Parameter Type Description
box undefined
selectFromEvent(e,item,renderer,dispatch)

Applies selection triggered by an user interaction

Parameter Type Description
e Event

The source event of the user interaction.

item Object

The render item that has been selected/deselected.

renderer Object

The visual renderer of the selected/deselected item.

dispatch Boolean

Whether an event must be dispatched or not.

Returns:Boolean | boolean

Returns true if the selection has changed and false otherwise.

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:

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

setItemSelected(item,value)

Change the selection state of an item.

Parameter Type Description
item Object

The item to change the selection state for.

value Boolean

True to select the item, false to deselect it.

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.

styleRenderer(renderer,item,level,kind)

Style the item renderer. This is called each time the treemap is refreshed. For leaf items it colors them with the color computed from the color model. For other items it does nothing.

Parameter Type Description
renderer DomNode

The item renderer.

item Object

The data item.

level Number

The item depth level.

kind String

The specified kind. This can either be "leaf", "group", "header" or "content".

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

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);
});
tooltipFunc(item,store)

A function that returns the tooltip of cell from a store item.
Default implementation is using tooltipAttr.

Parameter Type Description
item Object
store dojo/store/api/Store
Returns:null
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
updateRenderers(items)

Updates the renderer(s) that represent the specified item(s).

Parameter Type Description
items undefined
validateRendering()

Immediately validate the rendering if it has been invalidated. You generally do not call that method yourself.

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:

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

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

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

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(e)
Defined by: dojox/treemap/TreeMap
Parameter Type Description
e undefined

Examples

Example 1

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(e)
Defined by: dojox/treemap/TreeMap
Parameter Type Description
e undefined

Examples

Example 1

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(e)
Defined by: dojox/treemap/TreeMap
Parameter Type Description
e undefined

Examples

Example 1

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

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);
});
onChange()

Called when the selection changed.

Examples

Example 1

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

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);
});
onItemRollOut()
Defined by: dojox/treemap/TreeMap

Called when an item renderer has been rolled out.

Examples

Example 1

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);
});
onItemRollOver()
Defined by: dojox/treemap/TreeMap

Called when an item renderer has been hovered.

Examples

Example 1

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);
});
onRendererUpdated()
Defined by: dojox/treemap/TreeMap

Called when a renderer has been updated. This is called after creation, styling and sizing for each group and leaf renderers. For group renders this is also called after creation of children renderers.

Examples

Example 1

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!