Base class for validating, serializable, range-bound date or time text box.
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/form/_DateTimeTextBox reference documentation for more information.
The node to display the popup around. Can be set via a data-dojo-attach-point assignment. If missing, then domNode will be used.
Will set CSS class dijitUpArrow, dijitDownArrow, dijitRightArrow etc. on this node depending on where the drop down is set to be positioned. Can be set via a data-dojo-attach-point assignment. If missing, then _buttonNode will be used.
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.
The button/icon/node to click to display the drop down. Can be set via a data-dojo-attach-point assignment. If missing, then either focusNode or domNode (if focusNode is also missing) will be used.
Indicates that changes to the value should call onChange() callback. This is false during widget initialization, to avoid calling onChange() when the initial value is set.
The node to set the aria-expanded class on. Also sets popupActive class but that will be removed in 2.0. Can be set via a data-dojo-attach-point assignment. If missing, then focusNode or _buttonNode (if focusNode is missing) will be used.
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.
Specifies constraints.selector passed to dojo.date functions, should be either "date" or "time". Subclass must specify this.
When set to false, the click events will not be stopped, in case you want to use them in your subclass
True if mouse was pressed while over this widget, and hasn't been released yet
Corresponds to the native HTML <input>
element's attribute.
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:
"focusNode" ---> { node: "focusNode", type: "attribute" }
Despite the name, this parameter specifies both constraints on the input (including starting/ending dates/times allowed) as well as formatting options like whether the date is displayed in long (ex: December 25, 2005) or short (ex: 12/25/2005) format. See dijit/form/_DateTimeTextBox.__Constraints for details.
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.
JavaScript namespace to find calendar routines. If unspecified, uses Gregorian calendar routines at dojo/date and dojo/date/locale.
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.
Should this widget respond to user input? In markup, this is specified as "disabled='disabled'", or just "disabled".
For subclasses like ComboBox where the displayed value (ex: Kentucky) and the serialized value (ex: KY) are different, this represents the displayed value.
Setting 'displayedValue' through set('displayedValue', ...) updates 'value', and vice-versa. Otherwise 'value' is updated from 'displayedValue' periodically, like onBlur etc.
TODO: move declaration to MappedTextBox? Problem is that ComboBox references displayedValue, for benefit of FilteringSelect.
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.
The widget to display as a popup. This widget must be defined before the startup function is called.
The default value to focus in the popupClass widget when the textbox value is empty.
This variable controls the position of the drop down. It's an array of strings with the following values:
The list is positions is tried, in order, until a position is found where the drop down fits within the viewport.
This widget or a widget it contains has focus, or is "active" because it was recently clicked.
Set to true to make the drop down exactly as wide as this widget. Overrides autoWidth.
Set this textbox to display a down arrow button, to open the drop down list.
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.
Fires onChange for each value change or only on demand
The message to display if value is invalid. The translated string value is read from the message file by default. Set to "" to use the promptMessage instead.
Converts all characters to lowercase if true. Default is false.
The max height for our dropdown. Any dropdown taller than this will have scrollbars. Set to 0 for no max height, or -1 to limit height to available space in viewport
Currently error/prompt message. When using the default tooltip implementation, this will only be displayed when the field is focused.
The message to display if value is empty and the field is required. The translated string value is read from the message file by default. Set to "" to use the invalidMessage instead.
Name used when submitting form; same as "name" attribute or plain HTML elements
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
Defines a hint to help users fill out the input field (as defined in HTML 5). This should only contain plain text (no html markup).
Name of the popup widget class used to select a date/time. Subclasses should specify this.
If defined, display this hint string immediately on focus to the textbox, if empty. Also displays if the textbox value is Incomplete (not yet valid but will be with additional input). Think of this like a tooltip that tells the user what to do, not an error message that tells the user what they've done wrong.
Message disappears when user starts typing.
Converts the first character of each word to uppercase if true.
The message to display if value is out-of-range
Should this widget respond to user input? In markup, this is specified as "readOnly". Similar to disabled except readOnly form values are submitted.
On focus, should this widget scroll into view?
If true, all text will be selected when focused with mouse
Shows current state (ie, validation result) of input (""=Normal, Incomplete, or Error)
Order fields are traversed when user hits the tab key
Path to template (HTML file) for this widget relative to dojo.baseUrl. Deprecated: use templateString with require([... "dojo/text!..."], ...) instead
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.
See description of dijit/Tooltip.defaultPosition for details on this parameter.
Removes leading and trailing whitespace if true. Default is false.
Corresponds to the native HTML <input>
element's attribute.
Converts all characters to uppercase if true. Default is false.
The value of this widget as a JavaScript Date object. Use get("value") / set("value", val) to manipulate. When passed to the parser in markup, must be specified according to dojo/date/stamp.fromISOString()
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.
Hook to get the current regExp and to compute the partial validation RE.
Parameter | Type | Description |
---|---|---|
constraints | Object | An object with the following properties:
|
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 |
Parameter | Type | Description |
---|---|---|
attr | undefined | |
value | undefined |
Detach and clean up the attachments made in _attachtempalteNodes.
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 |
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 |
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 |
Hook so get('value') works as we like.
For dijit/form/TextBox this basically returns the value of the <input>
.
For dijit/form/MappedTextBox subclasses, which have both a "displayed value" and a separate "submit value", This treats the "displayed value" as the master value, computing the submit value from it via this.parse().
Called when the value of the widget is set. Calls onChange() if appropriate
Parameter | Type | Description |
---|---|---|
newValue | anything | the new value |
priorityChange | Boolean |
Optional For a slider, for example, dragging the slider is priorityChange==false, but on mouse up, it's priorityChange==true. If intermediateChanges==false, onChange is only called form priorityChange=true events. |
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
Returns true if the value is out of range and will remain out of range even if the user types more characters
Checks for whitespace
Parameter | Type | Description |
---|---|---|
value | undefined |
Runs various tests on the value, checking for invalid conditions
Parameter | Type | Description |
---|---|---|
value | Date |
Overrides dijit/form/ValidationTextBox._isValidSubset()
.
Returns true if the input is syntactically valid, and either within
range or could be made in range by more typing.
Work around table sizing bugs on IE7 by forcing redraw
Default action handler for user input events
Parameter | Type | Description |
---|---|---|
evt | Event |
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. |
Parameter | Type | Description |
---|---|---|
attr | undefined | |
value | undefined |
Parameter | Type | Description |
---|---|---|
constraints | Object |
Parameter | Type | Description |
---|---|---|
value | Boolean |
Parameter | Type | Description |
---|---|---|
value | String | |
priorityChange | Boolean |
Optional
|
Parameter | Type | Description |
---|---|---|
val | Date |
Parameter | Type | Description |
---|---|---|
message | String |
Parameter | Type | Description |
---|---|---|
pattern | String | Function |
Parameter | Type | Description |
---|---|---|
value | Boolean |
Parameter | Type | Description |
---|---|---|
value | String |
Parameter | Type | Description |
---|---|---|
newFcn | Function |
Parameter | Type | Description |
---|---|---|
value | Boolean |
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:
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):
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 |
Sets the date on this textbox. Note: value can be a JavaScript Date literal or a string to be parsed.
Parameter | Type | Description |
---|---|---|
value | Date | String | |
priorityChange | Boolean |
Optional
|
formattedValue | String |
Optional
|
Does substitution of ${foo} type properties in template string
Parameter | Type | Description |
---|---|---|
tmpl | undefined |
Handler for hover/active mouse event on widget's subnode
Parameter | Type | Description |
---|---|---|
node | undefined | |
clazz | undefined | |
evt | undefined |
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
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) |
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. |
Closes the drop down on this widget
Parameter | Type | Description |
---|---|---|
focus | Boolean | If true, refocuses the button widget |
Parameter | Type | Description |
---|---|---|
val1 | Date | |
val2 | Date |
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.
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. |
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. |
Deprecated, will be removed in 2.0, use handle.remove() instead.
Disconnects handle created by connect
.
Parameter | Type | Description |
---|---|---|
handle | undefined |
Overridable method to display validation errors/hints. By default uses a tooltip.
Parameter | Type | Description |
---|---|---|
message | String |
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
|
Auto-corrections (such as trimming) that are applied to textbox value on blur or form submit.
For MappedTextBox subclasses, this is called twice
and get('value'), ex: a Number for NumberTextBox.
In the latter case it does corrections like converting null to NaN. In the former case the NumberTextBox.filter() method calls this.inherited() to execute standard trimming code in TextBox.filter().
TODO: break this into two methods in 2.0
Parameter | Type | Description |
---|---|---|
val | undefined |
Formats the value as a Date, according to specified locale (second argument)
Parameter | Type | Description |
---|---|---|
value | Date | |
constraints | Object | An object with the following properties:
|
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.
Parameter | Type | Description |
---|---|---|
isFocused | Boolean |
Return a hint message to show when widget is first focused
Parameter | Type | Description |
---|---|---|
isFocused | Boolean |
Return true if this widget can currently be focused and false if not
Tests if the value is in the min/max range specified in constraints
Parameter | Type | Description |
---|---|---|
isFocused | Boolean |
Return this widget's explicit or implicit orientation (true for LTR, false for RTL)
Returns true if the dropdown exists and it's data is loaded. This can be overridden in order to force a call to loadDropDown().
Parameter | Type | Description |
---|---|---|
isFocused | Boolean |
Creates the drop down if it doesn't exist, loads the data if there's an href and it hasn't been loaded yet, and then opens the drop down. This is basically a callback when the user presses the down arrow button to open the drop down.
Deferred for the drop down widget that fires when drop down is created and loaded
Creates the drop down if it doesn't exist, loads the data if there's an href and it hasn't been loaded yet, and then calls the given callback.
Parameter | Type | Description |
---|---|---|
loadCallback | Function |
Parameter | Type | Description |
---|---|---|
type | String | Function | protected |
func | Function |
Parameter | Type | Description |
---|---|---|
callback | 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:
var handle = this.own(on(...))[0];
Parses as string as a Date, according to constraints
Parameter | Type | Description |
---|---|---|
value | String | |
constraints | Object | An object with the following properties:
|
Builds the regular needed to parse a localized date
Parameter | Type | Description |
---|---|---|
options | Object |
Optional An object with the following properties:
|
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.
// 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'); }));
// create a button out of a node with id="src" and append it to id="wrapper": var button = new Button({},"src").placeAt("wrapper");
// place a new button as the first element of some div var button = new Button({ label:"click" }).placeAt("wrapper","first");
// create a contentpane and add it to a TabContainer var tc = dijit.byId("myTabs"); new ContentPane({ href:"foo.html", title:"Wow!" }).placeAt(tc)
Kicks off widget instantiation. See create() for details.
Parameter | Type | Description |
---|---|---|
params | Object |
Optional
|
srcNodeRef | DomNode | String |
Overridable function used to validate the range of the numeric input value.
Parameter | Type | Description |
---|---|---|
primitive | Number | |
constraints | dijit/form/RangeBoundTextBox.__Constraints |
Deprecated. Use set('pattern', Function) instead.
Parameter | Type | Description |
---|---|---|
constraints | Object | An object with the following properties:
|
Parameter | Type | Description |
---|---|---|
val | anything | |
options | Object |
Optional
|
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. |
Set a property on a widget
Deprecated. Use set() instead.
Parameter | Type | Description |
---|---|---|
attr | String | |
value | anything |
Deprecated. Use set('disabled', ...) instead.
Parameter | Type | Description |
---|---|---|
disabled | Boolean |
Deprecated. Use set('displayedValue', ...) instead.
Parameter | Type | Description |
---|---|---|
value | String |
Deprecated. Use set('value', ...) instead.
Parameter | Type | Description |
---|---|---|
value | String |
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 |
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 the user presses the down arrow button or presses the down arrow key to open/close the drop down. Toggle the drop-down widget; if it is up, close it, if not, open it
Returns widget as a printable string using the widget's value
Deprecated. Override destroy() instead to implement custom widget tear-down behavior.
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 |
Overridable function used to validate the text input against the regular expression.
Parameter | Type | Description |
---|---|---|
value | anything | |
constraints | Object | An object with the following properties:
|
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:
var watchHandle = obj.watch("foo", callback); watchHandle.unwatch(); // callback won't be called now
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 |
---|---|---|
e | Event |
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 the user mousedown/touchstart on the arrow icon.
Parameter | Type | Description |
---|---|---|
e | Event |
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 on mouseup/touchend after mousedown/touchstart on the arrow icon. Note that this function is called regardless of what node the event occurred on (but only after a mousedown/touchstart on the arrow).
If the drop down is a simple menu and the cursor is over the menu, we execute it, otherwise, we focus our drop down widget. If the event is missing, then we are not a mouseup event.
This is useful for the common mouse movement pattern
with native browser <select>
nodes:
Parameter | Type | Description |
---|---|---|
e | Event |
Optional
|
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 |
---|---|---|
by | String |
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 AFTER the input event has happened See if the placeHolder text should be removed or added while editing.
Parameter | Type | Description |
---|---|---|
evt | Event |
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 the user presses a key while focused on the button node
Parameter | Type | Description |
---|---|---|
e | Event |
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); });
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 |
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.
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.
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 this widget's value is changed.
Parameter | Type | Description |
---|---|---|
newValue | undefined |
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 |
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.
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 |
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.
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
.
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 various user data-input events. Return false to cancel the event and prevent it from being processed.
Parameter | Type | Description |
---|---|---|
event | undefined | keydown | keypress | cut | paste | input |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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
.
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); });