The widget to orchestrate dynamic forms.
This widget hosts dojox.form.manager mixins. See _Mixin for more info.
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:
|
See the dojox/form/Manager reference documentation for more information.
List of connections associated with data-dojo-attach-event=... in the template
List of widget attribute names associated with data-dojo-attach-point=... in the template, ex: ["containerNode", "labelNode"]
Path to a blank 1x1 image.
Used by <img>
nodes in templates that really get their image via CSS background-image.
A fallback to preserve the 1.0 - 1.3 behavior of children in templates having their startup called before the parent widget fires postCreate. Defaults to 'false', causing child widgets to have their .startup() called immediately before a parent widget .startup(), but always after the parent .postCreate(). Set to 'true' to re-enable to previous, arguably broken, behavior.
Object to which attach points and events will be scoped. Defaults to 'this'.
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:
1 | "focusNode" ---> { node: "focusNode" , type: "attribute" } |
Root CSS class of the widget (ex: dijitTextBox), used to construct CSS classes to indicate widget state.
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.
Used to provide a context require to the dojo/parser in order to be
able to use relative MIDs (e.g. ./Widget
) in the widget's template.
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.
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.
This widget or a widget it contains has focus, or is "active" because it was recently clicked.
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.
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
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.
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.
Should we parse the template to find widgets that might be declared in markup inside it? (Remove for 2.0 and assume true)
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.
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 |
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:
Parameter | Type | Description |
---|---|---|
rootNode | DomNode | The node to search for properties. All descendants will be searched. |
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
|
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. |
Internal helper for directly changing an attribute value.
Detach and clean up the attachments made in _attachtempalteNodes.
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 |
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 |
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 |
Parameter | Type | Description |
---|---|---|
baseNode | DOMNode | Widget | |
getAttrFunc | undefined | |
attachFunc | undefined |
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 |
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 |
Add a class to nodes according to the supplied set of names
Parameter | Type | Description |
---|---|---|
className | String | Class name to add. |
names | Object |
Optional If it is an array, it is a list of names to be processed. If it is an object, dictionary keys are names to be processed. If it is omitted, all known form elements are to be processed. |
Add a class to nodes according to the supplied set of names
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. |
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 |
A handle that can be passed to disconnect
in order to disconnect before
the widget is destroyed.
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()); }); |
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:
|
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. |
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 |
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. |
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. |
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. |
Disable form controls according to the supplied state object returning the previous state.
Parameter | Type | Description |
---|---|---|
state | Object |
Optional Optional. If a name-value dictionary, the value is true to enable and false to disable. If an array, all names in the array will be disabled. If omitted, disables all. |
Deprecated, will be removed in 2.0, use handle.remove() instead.
Disconnects handle created by connect
.
Parameter | Type | Description |
---|---|---|
handle | undefined |
Set or get a form widget/element or an attached point node by name.
Parameter | Type | Description |
---|---|---|
name | String | The name. |
value | Object |
Optional Optional. The value to set. |
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
|
Enable form controls according to the supplied state object.
Parameter | Type | Description |
---|---|---|
state | Object |
Optional Optional. If a name-value dictionary, the value is true to enable and false to disable. If an array, all names in the array will be set to defaultState. If omitted, all form elements will be set to defaultState. |
defaultState | Boolean | The default state (true, if omitted). |
Enable form controls according to the supplied state object.
Set or get a form element by name.
Parameter | Type | Description |
---|---|---|
elem | String | Node | Array | Form element's name, DOM node, or array or radio nodes. |
value | Object |
Optional Optional. The value to set. |
For a getter it returns the value, for a setter it returns self. If the elem is not valid, null will be returned.
Set or get a node context by name (using dojoAttachPoint).
Parameter | Type | Description |
---|---|---|
elem | String | Object | Array | A node. |
value | Object |
Optional Optional. The value to set. |
For a getter it returns the value, for a setter it returns self. If the elem is not valid, null will be returned.
Set or get a form widget by name.
Parameter | Type | Description |
---|---|---|
elem | String | Object | Array | Form element's name, widget object, or array or radio widgets. |
value | Object |
Optional Optional. The value to set. |
For a getter it returns the value, for a setter it returns self. If the elem is not valid, null will be returned.
Gather the presence of a certain class in all controlled elements.
Parameter | Type | Description |
---|---|---|
className | String | The class name to test for. |
names | Object |
Optional If it is an array, it is a list of names to be processed. If it is an object, dictionary keys are names to be processed. If it is omitted, all known form elements are to be processed. |
Gather display state of all attached elements and return as a dictionary.
Parameter | Type | Description |
---|---|---|
names | Object |
Optional If it is an array, it is a list of names to be processed. If it is an object, dictionary keys are names to be processed. If it is omitted, all known attach point nodes are to be processed. |
Gather enable state of all form elements and return as a dictionary.
Parameter | Type | Description |
---|---|---|
names | Object |
Optional If it is an array, it is a list of names to be processed. If it is an object, dictionary keys are names to be processed. If it is omitted, all known form elements are to be processed. |
Collect form values.
Parameter | Type | Description |
---|---|---|
names | Object |
Optional If it is an array, it is a list of names of form elements to be collected. If it is an object, dictionary keys are names to be collected. If it is omitted, all known form elements are to be collected. |
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 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 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.
Hide attached nodes according to the supplied state object.
Parameter | Type | Description |
---|---|---|
state | Object |
Optional Optional. If a name-value dictionary, the value is true to show and false to hide. If an array, all names in the array will be hidden. If omitted, all form elements will be hidden. |
Run an inspector function on controlled elements returning a result object.
Parameter | Type | Description |
---|---|---|
inspector | Function | A function to be called on a widget, form element, and an attached node. Takes three arguments: a name, a node (domNode in the case of widget) or an array of such objects, and a supplied value. Runs in the context of the form manager. Returns a value that will be collected and returned as a state. |
state | Object |
Optional Optional. If a name-value dictionary --- only listed names will be processed. If an array, all names in the array will be processed with defaultValue. If omitted or null, all controlled elements will be processed with defaultValue. |
defaultValue | Object |
Optional Optional. The default state (true, if omitted). |
Run an inspector function on "dojoAttachPoint" nodes returning a result object.
Parameter | Type | Description |
---|---|---|
inspector | Function | A function to be called on a node. Takes three arguments: a name, a node or an array of nodes, and a supplied value. Runs in the context of the form manager. Returns a value that will be collected and returned as a state. |
state | Object |
Optional Optional. If a name-value dictionary --- only listed names will be processed. If an array, all names in the array will be processed with defaultValue. If omitted or null, all attached point nodes will be processed with defaultValue. |
defaultValue | Object |
Optional Optional. The default state (true, if omitted). |
Run an inspector function on controlled form elements returning a result object.
Parameter | Type | Description |
---|---|---|
inspector | Function | A function to be called on a form element. Takes three arguments: a name, a node or an array of nodes, and a supplied value. Runs in the context of the form manager. Returns a value that will be collected and returned as a state. |
state | Object |
Optional Optional. If a name-value dictionary --- only listed names will be processed. If an array, all names in the array will be processed with defaultValue. If omitted or null, all form elements will be processed with defaultValue. |
defaultValue | Object |
Optional Optional. The default state (true, if omitted). |
Run an inspector function on controlled widgets returning a result object.
Parameter | Type | Description |
---|---|---|
inspector | Function | A function to be called on a widget. Takes three arguments: a name, a widget object or an array of widget objects, and a supplied value. Runs in the context of the form manager. Returns a value that will be collected and returned as a state. |
state | Object |
Optional Optional. If a name-value dictionary --- only listed names will be processed. If an array, all names in the array will be processed with defaultValue. If omitted or null, all widgets will be processed with defaultValue. |
defaultValue | Object |
Optional Optional. The default state (true, if omitted). |
Return true if this widget can currently be focused and false if not
Return this widget's explicit or implicit orientation (true for LTR, false for RTL)
Make sure that every widget that has a validator function returns true.
Parameter | Type | Description |
---|---|---|
type | String | Function | protected |
func | Function |
Track specified handles and remove/destroy them when this instance is destroyed, unless they were already removed/destroyed manually.
The array of specified handles, so you can do for example:
1 | var handle = this .own(on(...))[0]; |
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(). |
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.
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' ); })); |
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" ); |
1 2 | // place a new button as the first element of some div var button = new Button({ label: "click" }).placeAt( "wrapper" , "first" ); |
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) |
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.
Kicks off widget instantiation. See create() for details.
Parameter | Type | Description |
---|---|---|
params | Object |
Optional
|
srcNodeRef | DomNode | String |
Register a node with the form manager
Parameter | Type | Description |
---|---|---|
node | String | Node | A node, or its id |
Returns self
Register node's descendants (form nodes) with the form manager
Parameter | Type | Description |
---|---|---|
node | String | Node | A widget, or its widgetId, or its DOM node |
Returns self
Register a widget with the form manager
Parameter | Type | Description |
---|---|---|
widget | String | Node | dijit/form/_FormWidget | A widget, or its widgetId, or its DOM node |
Returns self
Register widget's descendants with the form manager
Parameter | Type | Description |
---|---|---|
widget | String | Node | dijit._Widget | A widget, or its widgetId, or its DOM node |
Returns self
Remove a class from nodes according to the supplied set of names
Parameter | Type | Description |
---|---|---|
className | String | Class name to remove. |
names | Object |
Optional If it is an array, it is a list of names to be processed. If it is an object, dictionary keys are names to be processed. If it is omitted, all known form elements are to be processed. |
Remove a class from nodes according to the supplied set of names
Resets form widget values.
Resets form widget values.
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. |
Set a property on a widget
Deprecated. Use set() instead.
Parameter | Type | Description |
---|---|---|
attr | String | |
value | anything |
Set values to form elements
Parameter | Type | Description |
---|---|---|
values | Object | A dictionary of key-value pairs. |
Set values to form elements
Show attached nodes according to the supplied state object.
Parameter | Type | Description |
---|---|---|
state | Object |
Optional Optional. If a name-value dictionary, the value is true to show and false to hide. If an array, all names in the array will be set to defaultState. If omitted, all form elements will be set to defaultState. |
defaultState | Boolean |
Optional The default state (true, if omitted). |
Show attached nodes according to the supplied state object.
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.
programmatically submit form if and only if the onSubmit
returns true
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 |
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); }); |
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.
Deprecated. Override destroy() instead to implement custom widget tear-down behavior.
Removes the node by name from internal tables unregistering connected observers
Parameter | Type | Description |
---|---|---|
name | String | Name of the to unregister |
Returns self
Unregister node's descendants (form nodes) with the form manager
Parameter | Type | Description |
---|---|---|
node | String | Node | A widget, or its widgetId, or its DOM node |
Returns self
Removes the widget by name from internal tables unregistering connected observers
Parameter | Type | Description |
---|---|---|
name | String | Name of the to unregister |
Returns self
Unregister widget's descendants with the form manager
Parameter | Type | Description |
---|---|---|
widget | String | Node | dijit/_Widget | A widget, or its widgetId, or its DOM node |
Returns self
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 |
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
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. |
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 |
This is where widgets do processing for when they stop being active, such as changing CSS classes. See onBlur() for more details.
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); }); |
This is where widgets do processing for when they are active, such as changing CSS classes. See onFocus() for more details.
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); }); |
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 |
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); }); |
Parameter | Type | Description |
---|---|---|
evt | undefined |
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); }); |
Internal method called when this widget is made visible.
See onShow
for details.
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); }); |
Parameter | Type | Description |
---|---|---|
evt | undefined |
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); }); |
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.
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); }); |
Connect to this function to receive notifications of mouse click events.
Parameter | Type | Description |
---|---|---|
event | undefined | mouse Event |
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); }); |
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.
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); }); |
Connect to this function to receive notifications of mouse double click events.
Parameter | Type | Description |
---|---|---|
event | undefined | mouse Event |
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); }); |
Called when the widget becomes "active" because it or a widget inside of it either has focus, or has recently been clicked.
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); }); |
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
.
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); }); |
Connect to this function to receive notifications of keys being pressed down.
Parameter | Type | Description |
---|---|---|
event | undefined | key Event |
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); }); |
Connect to this function to receive notifications of printable keys being typed.
Parameter | Type | Description |
---|---|---|
event | undefined | key Event |
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); }); |
Connect to this function to receive notifications of keys being released.
Parameter | Type | Description |
---|---|---|
event | undefined | key Event |
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); }); |
Connect to this function to receive notifications of when the mouse button is pressed down.
Parameter | Type | Description |
---|---|---|
event | undefined | mouse Event |
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); }); |
Connect to this function to receive notifications of when the mouse moves onto this widget.
Parameter | Type | Description |
---|---|---|
event | undefined | mouse Event |
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); }); |
Connect to this function to receive notifications of when the mouse moves off of this widget.
Parameter | Type | Description |
---|---|---|
event | undefined | mouse Event |
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); }); |
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 |
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); }); |
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 |
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); }); |
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 |
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); }); |
Connect to this function to receive notifications of when the mouse button is released.
Parameter | Type | Description |
---|---|---|
event | undefined | mouse Event |
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); }); |
Callback when user resets the form. This method is intended
to be over-ridden. When the reset
method is called
programmatically, the return value from onReset
is used
to compute whether or not resetting should proceed
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); }); |
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
.
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); }); |
Callback when user submits the form. This method is
intended to be over-ridden, but by default it checks and
returns the validity of form elements. When the submit
method is called programmatically, the return value from
onSubmit
is used to compute whether or not submission
should proceed
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); }); |