dojox/mvc/_base._Controller (version 1.10)

dojo/Stateful, dojox/mvc/_atBindingMixin

See the dojox/mvc/_base._Controller reference documentation for more information.

Property Summary

Method Summary

  • _changeAttrValue(name,value) Internal helper for directly changing an attribute value.
  • _dbpostscript(params,srcNodeRef) See if any parameters for this widget are dojox/mvc/at handles.
  • _get(name,names) Private function that does a get based off a hash of names
  • _getAttrNames(name) Helper function for get() and set().
  • _getExcludesAttr() Returns list of all properties that data binding is established with.
  • _getPropertiesAttr() Returns list of all properties in this widget, except "id".
  • _set(name,value) Implement _set() interface so that _set() behavior is consistent whether the instance inherits _WidgetBase or not.
  • _setAtWatchHandle(name,value) Called if the value is a dojox/mvc/at handle.
  • _setBind(value) Sets data binding described in data-mvc-bindings.
  • _startAtWatchHandles(bindWith) Establish data bindings based on dojox/mvc/at handles.
  • _stopAtWatchHandles() Stops data binding synchronization handles as widget is destroyed.
  • destroy() Stops data binding as this object is destroyed.
  • get(name) Get a property on a Stateful instance.
  • postscript(params,srcNodeRef) If this object is not called from Dojo parser, starts this up right away.
  • set(name,value) If the value given is dojox/mvc/at handle, use it for data binding.
  • startup() Starts up data binding as this object starts up.
  • watch(name,callback) Watches a property for changes

Properties

_attrPairNames
Defined by: dojo/Stateful

Used across all instances a hash to cache attribute names and their getter and setter names.

data-mvc-bindings
dataBindAttr

The attribute name for data binding.

Methods

_changeAttrValue(name,value)
Defined by dojo/Stateful

Internal helper for directly changing an attribute value.

Directly change the value of an attribute on an object, bypassing any accessor setter. Also handles the calling of watch and emitting events. It is designed to be used by descendant class when there are two values of attributes that are linked, but calling .set() is not appropriate.

Parameter Type Description
name String

The property to set.

value Mixed

The value to set in the property.

Returns:function

Internal helper for directly changing an attribute value.

_dbpostscript(params,srcNodeRef)

See if any parameters for this widget are dojox/mvc/at handles. If so, move them under this._refs to prevent widget implementations from referring them.

Parameter Type Description
params Object
Optional
srcNodeRef DomNode | String
_get(name,names)
Defined by dojo/Stateful

Private function that does a get based off a hash of names

Parameter Type Description
name undefined
names undefined

Hash of names of custom attributes

Returns:undefined
_getAttrNames(name)
Defined by dojo/Stateful

Helper function for get() and set(). Caches attribute name values so we don't do the string ops every time.

Parameter Type Description
name undefined
Returns:undefined | object
_getExcludesAttr()

Returns list of all properties that data binding is established with.

Returns:undefined | Array
_getPropertiesAttr()

Returns list of all properties in this widget, except "id".

Returns:String[] | undefined

The list of all properties in this widget, except "id"..

_set(name,value)

Implement _set() interface so that _set() behavior is consistent whether the instance inherits _WidgetBase or not. If the instance does not inherit _WidgetBase, use dojo/Stateful/_changeAttrValue() that's equivalent to dijit/_WidgetBase._set().

Parameter Type Description
name String

The property name.

value Anything

The property value.

Returns:undefined
_setAtWatchHandle(name,value)

Called if the value is a dojox/mvc/at handle. If this widget has started, start data binding with the new dojox/mvc/at handle. Otherwise, queue it up to this._refs so that _dbstartup() can pick it up.

Parameter Type Description
name String
value Anything
_setBind(value)

Sets data binding described in data-mvc-bindings.

Parameter Type Description
value Object
_startAtWatchHandles(bindWith)

Establish data bindings based on dojox/mvc/at handles.

Parameter Type Description
bindWith dojo/Stateful

The dojo/Stateful to bind properties with.

_stopAtWatchHandles()

Stops data binding synchronization handles as widget is destroyed.

destroy()

Stops data binding as this object is destroyed.

get(name)
Defined by dojo/Stateful

Get a property on a Stateful instance.

Get a named property on a Stateful object. The property may potentially be retrieved via a getter method in subclasses. In the base class this just retrieves the object's property.

Parameter Type Description
name String

The property to get.

Returns:any | undefined

The property value on this Stateful instance.

Examples

Example 1

require(["dojo/Stateful", function(Stateful) {
    var stateful = new Stateful({foo: 3});
    stateful.get("foo") // returns 3
    stateful.foo // returns 3
});
postscript(params,srcNodeRef)

If this object is not called from Dojo parser, starts this up right away. Also, if widget registry is available, register this object.

Parameter Type Description
params Object
Optional
srcNodeRef DomNode | String
Optional
Returns:undefined
set(name,value)

If the value given is dojox/mvc/at handle, use it for data binding. Otherwise, if setter function is there, use it. Otherwise, set the value to the data model or to this object.

Parameter Type Description
name String

The property name.

value Anything

The property value.

Returns:function | undefined

If the value given is dojox/mvc/at handle, use it for data binding. Otherwise, if setter function is there, use it. Otherwise, set the value to the data model or to this object.

startup()

Starts up data binding as this object starts up.

watch(name,callback)
Defined by dojo/Stateful

Watches a property for changes

Parameter Type Description
name String
Optional

Indicates the property to watch. This is optional (the callback may be the only parameter), and if omitted, all the properties will be watched

callback Function

The function to execute when the property changes. This will be called after the property has been changed. The callback will be called with the |this| set to the instance, the first argument as the name of the property, the second argument as the old value and the third argument as the new value.

Returns:any | object

An object handle for the watch. The unwatch method of this object can be used to discontinue watching this property:

var watchHandle = obj.watch("foo", callback);
watchHandle.unwatch(); // callback won't be called now
Error in the documentation? Can’t find what you are looking for? Let us know!