See the dojox/mvc/Bind reference documentation for more information.
Returns a pointer to data binding target (a dojo/Stateful property), called at handle, which is used for start synchronization with data binding source (another dojo/Stateful property).
Typically used in data-dojo-props so that a widget can synchronize its attribute with another dojo/Stateful, like shown in the example.
Parameter | Type | Description |
---|---|---|
target | dojo/Stateful | String | dojo/Stateful to be synchronized. |
targetProp | String | The property name in target to be synchronized. |
A pointer to data binding target (a dojo/Stateful property), called at handle, which is used for start synchronization with data binding source (another dojo/Stateful property).
Two seconds later, the text box changes from "Foo" to "Bar" as the "value" property in model changes.
<html> <head> <script src="/path/to/dojo-toolkit/dojo/dojo.js" type="text/javascript" data-dojo-config="parseOnLoad: 0"></script> <script type="text/javascript"> require([ "dojo/parser", "dojo/Stateful", "dijit/form/TextBox", "dojo/domReady!" ], function(parser, Stateful){ model = new Stateful({value: "Foo"}); setTimeout(function(){ model.set("value", "Bar"); }, 2000); parser.parse(); }); </script> </head> <body> <script type="dojo/require">at: "dojox/mvc/at"</script> <input type="text" data-dojo-type="dijit/form/TextBox" data-dojo-props="value: at(model, 'value')"> </body> </html>
Edit in text box is reflected to the text next to it.
<html> <head> <script src="/path/to/dojo-toolkit/dojo/dojo.js" type="text/javascript" data-dojo-config="parseOnLoad: 0"></script> <script type="text/javascript"> require([ "dojo/parser", "dojo/Stateful", "dojo/domReady!" ], function(parser, Stateful){ model = new Stateful({value: "Foo"}); parser.parse(); }); </script> </head> <body> <script type="dojo/require">at: "dojox/mvc/at"</script> <input type="text" data-dojo-type="dijit/form/TextBox" data-dojo-props="value: at(model, 'value')"> <span data-dojo-type="dijit/_WidgetBase" data-dojo-props="_setValueAttr: {node: 'domNode', type: 'innerText'}, value: at(model, 'value')"></span> </body> </html>
Bind the specified property of the target to the specified property of the source with the supplied transformation.
Parameter | Type | Description |
---|---|---|
source | dojo/Stateful | The source dojo/Stateful object for the bind. |
sourceProp | String | The name of the source's property whose change triggers the bind. |
target | dojo/Stateful | The target dojo/Stateful object for the bind whose property will be updated with the result of the function. |
targetProp | String | The name of the target's property to be updated with the result of the function. |
func | Function |
Optional The optional calculation to be performed to obtain the target property value. |
bindOnlyIfUnequal | Boolean |
Optional Whether the bind notification should happen only if the old and new values are unequal (optional, defaults to false). |
Bind the values at the sources specified in the first argument array such that a composing function in the second argument is called when any of the values changes.
Parameter | Type | Description |
---|---|---|
sourceBindArray | dojo/Stateful[] | The array of dojo/Stateful objects to watch values changes on. |
func | Function | The composing function that is called when any of the source values changes. |
Compares two dojo/Stateful objects, by diving into the leaves.
Recursively iterates and compares stateful values.
Parameter | Type | Description |
---|---|---|
dst | Anything | The stateful value to compare with. |
src | Anything | The stateful value to compare with. |
options | dojox/mvc/equalsOptions | The object that defines how two stateful values are compared. |
True if dst equals to src, false otherwise.
Create a raw value from a dojo/Stateful object.
Recursively iterates the stateful value given, and convert them to raw ones.
Parameter | Type | Description |
---|---|---|
value | Anything | The stateful value. |
options | dojox/mvc/getPlainValueOptions | The object that defines how plain value should be created from stateful value. |
The converted value.
Create a dojo/Stateful object from a raw value.
Recursively iterates the raw value given, and convert them to stateful ones.
Parameter | Type | Description |
---|---|---|
value | Anything | The raw value. |
options | dojox/mvc/getStatefulOptions | The object that defines how model object should be created from plain object hierarchy. |
The converted value.
Factory method that instantiates a new data model that view components may bind to.
Factory method that returns a client-side data model, which is a tree of dojo/Stateful objects matching the initial data structure passed as input:
This function returns an immediate dojox.mvc.StatefulModel instance or a Promise for such an instance as follows:
Parameter | Type | Description |
---|---|---|
args | Object | The mixin properties. |
Find a dojo/Stateful for the target.
If target is not a string, return target itself. If target is "widget:widgetid", returns the widget whose ID is widgetid. If target is "rel:object.path", or target is other string, returns an object under parent (if specified) or under global scope.
Parameter | Type | Description |
---|---|---|
target | dojo/Stateful | String | The data binding to resolve. |
parent | dojo/Stateful |
Optional The parent data binding. Used when the data binding is defined inside repeat. |
An inheritance of native JavaScript array, that adds dojo/Stateful capability.
Supported methods are:
Parameter | Type | Description |
---|---|---|
a | Anything[] |
Synchronize two dojo/Stateful properties.
Synchronize two dojo/Stateful properties.
Parameter | Type | Description |
---|---|---|
source | dojo/Stateful | Source dojo/Stateful to be synchronized. |
sourceProp | String | The property name in source to be synchronized. |
target | dojo/Stateful | Target dojo/Stateful to be synchronized. |
targetProp | String | The property name in target to be synchronized. |
options | dojox/mvc/sync.options | Data binding options. |
The handle of data binding synchronization.