dijit/Dialog._DialogBase (version 1.10)

dijit/_TemplatedMixin, dijit/form/_FormMixin, dijit/_DialogMixin, dijit/_CssStateMixin

Usage

var foo = new Dialog._DialogBase(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.

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"]
  • _firstFocusItemThe pointer to the first focusable node in the dialog.
  • _lastFocusItemThe pointer to which node has focus prior to our dialog.
  • _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.
  • _skipNodeCache
  • actionBarTemplateHTML snippet to show the action bar (gray bar with OK/cancel buttons).
  • 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.
  • autofocusA Toggle to modify the default focus behavior of a Dialog, which is to focus on the first dialog element after opening the dialog.
  • baseClass
  • closableDialog show [x] icon to close itself, and ESC key will close the dialog.
  • cssStateNodes
  • draggableToggles the movable aspect of the Dialog.
  • durationThe time in milliseconds it takes the dialog to fade in and out
  • hoveringTrue if cursor is over this widget
  • maxRatioMaximum size to allow the dialog to expand to, relative to viewport size
  • openTrue if Dialog is currently displayed on screen.
  • refocusA Toggle to modify the default focus behavior of a Dialog, which is to re-focus the element which had focus before being opened.
  • searchContainerNode
  • stateWill be "Error" if one or more of the child widgets has an invalid value, "Incomplete" if not all of the required child widgets are filled in.
  • templatePathPath to template (HTML file) for this widget relative to dojo.baseUrl.
  • templateString

Method Summary

  • _applyAttributes()
  • _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.
  • _beforeFillContent()
  • _cssMouseEvent(event) Handler for CSS event on this.domNode.
  • _detachTemplateNodes() Detach and clean up the attachments made in _attachtempalteNodes.
  • _endDrag() Called after dragging the Dialog.
  • _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})
  • _fillContent(source) Relocate source contents to templated container node. this.containerNode must be able to receive children, or exceptions will be thrown.
  • _getDescendantFormWidgets(children) Returns all form widget descendants, searching through non-form child widgets like BorderContainer
  • _getFocusItems() Finds focusable items in dialog, and sets this._firstFocusItem and this._lastFocusItem
  • _getState() Compute what this.state should be based on state of children
  • _getValueAttr() Returns Object representing form values.
  • _layoutChildren()
  • _position() Position the dialog in the viewport.
  • _processTemplateNode(baseNode,getAttrFunc,attachFunc) Process data-dojo-attach-point and data-dojo-attach-event for given node or widget.
  • _setClosableAttr(val)
  • _setDraggableAttr(val)
  • _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).
  • _setTextDirAttr(textDir)
  • _setTitleAttr(title)
  • _setup() Stuff we need to do before showing the Dialog for the first time (but we defer it until right beforehand, for performance reasons).
  • _setValueAttr(obj) Fill in form values from according to an Object (in the format returned by get('value'))
  • _size()
  • _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.
  • buildRendering() Construct the UI for this widget from a template, setting this.domNode.
  • connectChildren(inStartup) You can call this function directly, ex. in the event that you programmatically add a widget to the form after the form has been initialized.
  • destroy()
  • destroyRendering()
  • disconnectChildren() Deprecated method.
  • execute(formContents) Callback when the user hits the submit button.
  • focus()
  • getValues()
  • hide() Hide the dialog
  • isValid() Returns true if all of the widgets are valid.
  • postCreate()
  • postMixInProperties()
  • reset()
  • resize(dim) Called with no argument when viewport scrolled or viewport size changed.
  • setValues(val)
  • show() Display the dialog
  • startup()
  • validate() returns if the form is valid - same as isValid - but provides a few additional (ui-specific) features: it will highlight any sub-widgets that are not valid it will call focus() on the first invalid sub-widget

Event Summary

  • _onChildChange(attr) Called when child's value or disabled state changes
  • _onKey(evt) Handles the keyboard events for accessibility reasons
  • _onSubmit() Callback when user hits submit button
  • onCancel() Called when user has pressed the Dialog's cancel button, to notify container.
  • onExecute() Called when user has pressed the dialog's OK button, to notify container.
  • onLoad() Called when data has been loaded from an href.
  • onValidStateChange(isValid) Stub function to connect to if you want to do something (like disable/enable a submit button) when the valid state changes on the form as a whole.

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

_firstFocusItem
Defined by: dijit/Dialog

The pointer to the first focusable node in the dialog. Set by dijit/_DialogMixin._getFocusItems().

_lastFocusItem
Defined by: dijit/Dialog

The pointer to which node has focus prior to our dialog. Set by dijit/_DialogMixin._getFocusItems().

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

_skipNodeCache
Defined by: dijit/_TemplatedMixin
actionBarTemplate
Defined by: dijit/_DialogMixin

HTML snippet to show the action bar (gray bar with OK/cancel buttons). Blank by default, but used by ConfirmDialog/ConfirmTooltipDialog subclasses.

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

autofocus
Defined by: dijit/Dialog

A Toggle to modify the default focus behavior of a Dialog, which is to focus on the first dialog element after opening the dialog. False will disable autofocusing. Default: true

baseClass
Defined by: dijit/Dialog
closable
Defined by: dijit/Dialog

Dialog show [x] icon to close itself, and ESC key will close the dialog.

cssStateNodes
Defined by: dijit/Dialog
draggable
Defined by: dijit/Dialog

Toggles the movable aspect of the Dialog. If true, Dialog can be dragged by it's title. If false it will remain centered in the viewport.

duration
Defined by: dijit/Dialog

The time in milliseconds it takes the dialog to fade in and out

hovering
Defined by: dijit/_CssStateMixin

True if cursor is over this widget

maxRatio
Defined by: dijit/Dialog

Maximum size to allow the dialog to expand to, relative to viewport size

open
Defined by: dijit/Dialog

True if Dialog is currently displayed on screen.

refocus
Defined by: dijit/Dialog

A Toggle to modify the default focus behavior of a Dialog, which is to re-focus the element which had focus before being opened. False will disable refocusing. Default: true

searchContainerNode
Defined by: dijit/_TemplatedMixin
state
Defined by: dijit/form/_FormMixin

Will be "Error" if one or more of the child widgets has an invalid value, "Incomplete" if not all of the required child widgets are filled in. Otherwise, "", which indicates that the form is ready to be submitted.

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

Methods

_applyAttributes()
_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
_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.

_endDrag()
Defined by dijit/Dialog

Called after dragging the Dialog. Saves the position of the dialog in the viewport, and also adjust position to be fully within the viewport, so user doesn't lose access to handle

_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
_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
_getDescendantFormWidgets(children)

Returns all form widget descendants, searching through non-form child widgets like BorderContainer

Parameter Type Description
children dijit/_WidgetBase[]
Optional
Returns:Array
_getFocusItems()
Defined by dijit/_DialogMixin

Finds focusable items in dialog, and sets this._firstFocusItem and this._lastFocusItem

_getState()

Compute what this.state should be based on state of children

Returns:string
_getValueAttr()

Returns Object representing form values. See description of value for details.

Returns:object
_layoutChildren()
Defined by dijit/Dialog
_position()
Defined by dijit/Dialog

Position the dialog in the viewport. If no relative offset in the viewport has been determined (by dragging, for instance), center the dialog. Otherwise, use the Dialog's stored relative offset, adjusted by the viewport's scroll.

_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
_setClosableAttr(val)
Defined by dijit/Dialog
Parameter Type Description
val undefined
_setDraggableAttr(val)
Defined by dijit/Dialog
Parameter Type Description
val Boolean
_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
_setTextDirAttr(textDir)
Defined by dijit/Dialog
Parameter Type Description
textDir undefined
_setTitleAttr(title)
Defined by dijit/Dialog
Parameter Type Description
title String
_setup()
Defined by dijit/Dialog

Stuff we need to do before showing the Dialog for the first time (but we defer it until right beforehand, for performance reasons).

_setValueAttr(obj)

Fill in form values from according to an Object (in the format returned by get('value'))

Parameter Type Description
obj Object
_size()
Defined by dijit/Dialog
_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)

buildRendering()

Construct the UI for this widget from a template, setting this.domNode.

connectChildren(inStartup)

You can call this function directly, ex. in the event that you programmatically add a widget to the form after the form has been initialized.

Parameter Type Description
inStartup Boolean
destroy()
Defined by dijit/Dialog
destroyRendering()
Defined by dijit/_AttachMixin
disconnectChildren()

Deprecated method. Applications no longer need to call this. Remove for 2.0.

execute(formContents)
Defined by dijit/_DialogMixin

Callback when the user hits the submit button. Override this method to handle Dialog execution.

After the user has pressed the submit button, the Dialog first calls onExecute() to notify the container to hide the dialog and restore focus to wherever it used to be.

Then this method is called.

Parameter Type Description
formContents Object
focus()
Defined by dijit/Dialog
getValues()
Returns:undefined
hide()
Defined by dijit/Dialog

Hide the dialog

Returns:dojo/promise/Promise | undefined

Promise object that resolves when the display animation is complete

isValid()

Returns true if all of the widgets are valid. Deprecated, will be removed in 2.0. Use get("state") instead.

Returns:boolean
postCreate()
Defined by dijit/Dialog
postMixInProperties()
Defined by dijit/Dialog
reset()
resize(dim)
Defined by dijit/Dialog

Called with no argument when viewport scrolled or viewport size changed. Adjusts Dialog as necessary to keep it visible.

Can also be called with an argument (by dojox/layout/ResizeHandle etc.) to explicitly set the size of the dialog.

Parameter Type Description
dim Object
Optional

Optional dimension object like {w: 200, h: 300}

setValues(val)
Parameter Type Description
val undefined
Returns:undefined
show()
Defined by dijit/Dialog

Display the dialog

Returns:dojo/promise/Promise | undefined

Promise object that resolves when the display animation is complete

startup()
validate()

returns if the form is valid - same as isValid - but provides a few additional (ui-specific) features:

  1. it will highlight any sub-widgets that are not valid
  2. it will call focus() on the first invalid sub-widget
Returns:undefined

Events

_onChildChange(attr)
Defined by: dijit/form/_FormMixin

Called when child's value or disabled state changes

Parameter Type Description
attr String
_onKey(evt)
Defined by: dijit/Dialog

Handles the keyboard events for accessibility reasons

Parameter Type Description
evt Event
_onSubmit()
Defined by: dijit/_DialogMixin

Callback when user hits submit button

onCancel()
Defined by: dijit/_DialogMixin

Called when user has pressed the Dialog's cancel button, to notify container.

Developer shouldn't override or connect to this method; it's a private communication device between the TooltipDialog and the thing that opened it (ex: dijit/form/DropDownButton)

onExecute()
Defined by: dijit/_DialogMixin

Called when user has pressed the dialog's OK button, to notify container.

Developer shouldn't override or connect to this method; it's a private communication device between the TooltipDialog and the thing that opened it (ex: dijit/form/DropDownButton)

onLoad()
Defined by: dijit/Dialog

Called when data has been loaded from an href. Unlike most other callbacks, this function can be connected to (via dojo.connect) but should not be overridden.

onValidStateChange(isValid)
Defined by: dijit/form/_FormMixin

Stub function to connect to if you want to do something (like disable/enable a submit button) when the valid state changes on the form as a whole.

Deprecated. Will be removed in 2.0. Use watch("state", ...) instead.

Parameter Type Description
isValid Boolean
Error in the documentation? Can’t find what you are looking for? Let us know!