dijit/_AttachMixin (version 1.10)

Summary

Mixin for widgets to attach to dom nodes and setup events via convenient data-dojo-attach-point and data-dojo-attach-event DOM attributes.

Superclass of _TemplatedMixin, and can also be used standalone when templates are pre-rendered on the server.

Does not [yet] handle widgets like ContentPane with this.containerNode set. It should skip scanning for data-dojo-attach-point and data-dojo-attach-event inside this.containerNode, but it doesn't.

Usage

var foo = new _AttachMixin(params,srcNodeRef);
dijit/_AttachMixin
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, replace srcNodeRef with my generated DOM tree.

See the dijit/_AttachMixin 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"]
  • attachScopeObject to which attach points and events will be scoped.
  • searchContainerNodeSearch descendants of this.containerNode for data-dojo-attach-point and data-dojo-attach-event.

Method Summary

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"]

attachScope
Defined by: dijit/_AttachMixin

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

searchContainerNode
Defined by: dijit/_AttachMixin

Search descendants of this.containerNode for data-dojo-attach-point and data-dojo-attach-event. Should generally be left false (the default value) both for performance and to avoid failures when this.containerNode holds other _AttachMixin instances with their own attach points and events.

Methods

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

_beforeFillContent()
Defined by dijit/_AttachMixin
_detachTemplateNodes()
Defined by dijit/_AttachMixin

Detach and clean up the attachments made in _attachtempalteNodes.

_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
buildRendering()
Defined by dijit/_AttachMixin

Attach to DOM nodes marked with special attributes.

destroyRendering()
Defined by dijit/_AttachMixin
Error in the documentation? Can’t find what you are looking for? Let us know!